Generally speaking, the air above the ground is territorial but by international agreement can be flown without involvement of the authorities except as needed for air traffic control. From a practical standpoint when you transit the airspace of a nation you will need to contact ATC and advise your destination, receive a transponder code, and generally advise them of who you are. If you are transiting their airspace that is mostly what is involved. Most nations have some kind of air traffic control and you will need to comply with their routings, altitude, etc.. The is no need for inspection, Customs, immigration, or otherwise.
The rules of the ocean are different and I’m still learning those. I suppose one could transit Canadian waters without stopping and avoid Customs but you would still be subject to inspection within their territorial waters.