In-universe:
First, even though space is indeed 3D, most solar systems/galaxies are relatively flat. So, a ship enroute from, say, DS9 to Earth would approach the Sol system at a relatively low angle of incidence relative to the ecliptic plane of the galaxy (but possibly not to the ecliptic plane of the Sol system itself).
Second, even in a 3D space, there has to be a common "up" and "down" (Z-axis) in the coordinate system. For our Milky Way galaxy, the most natural "up" is one or the other of the normals to the plane of the galaxy. While in a stellar system, "up" would be one of the two normals to that system's orbital plane. It would follow then that unless a ship were travelling directly "up" or "down" through the galaxy or stellar system along this normal vector, it would maneuver to keep itself oriented roughly "top-up", to avoid navigational confusion.
Third, though the shows/movies don't dwell on the real physics of this, ships in ST do orbit planets. Although there are an infinite number of possible orbital planes, even in one direction, the most logical (and easiest to break) is to orbit in the same direction as the planet's orbit around its star, within the same plane as the planet's stellar orbit. There may even be regulations requiring this while in well-travelled areas of space to avoid collisions.
Lastly, even if one ship is approaching another from a wild angle of incidence, one of two things would likely happen. If the ships are friendly, the incoming ship would match course with the ship it was approaching. If the ships are hostile, the ship being approached would turn to face the enemy (thus allowing the captain to bring the most powerful weapons he has - torpedoes - to bear with minimal targeting, and also pointing the highest number of phaser banks at the enemy ship).
Out-of-universe, having two ships, or formations of same, be aligned in attitude when facing each other is mostly for the audience's benefit. We're not used to seeing things "upside-down" while at rest, and with a large variety of ship configurations in the Federation fleet (nacelles-down, nacelles-up, "barrel section" or no, etc) you at least need an "establishing shot" showing the ship in a "normal" attitude, before you begin playing with relative attitudes during combat or other wild maneuvering. So, even if two ships approached each other with each one looking "upside-down" to the other, it would make sense to have the approaching vessel match axes with the ship being approached so the audience can easily recognize the two ships in question.
Understand that the camera angles still may not indicate the true orientation of the two ships relative to the galactic plane (our common "up"). They may be meeting at an angle 30 degrees off the plane, and inverted. As long as they are both "right-side-up" relative to each other, there is a camera angle that would make them appear to be traveling through space as if it were a 2D surface.