Short Answer
In a realistic world, most vessels will be optimized for a single environment (space for space stations, bicycles for land, or submarines for underwater). Some vessels may be capable of travelling in two environments, but they aren't good at either environment, and the more different the two environments are, the harder it is to justify the vessel's existence in your world.
For example, although flying cars exist...sort of (see image below)...they are not commercially viable. They’re too expensive for the daily commute to work (bikes, busses and cars are the better alternatives), but not efficient enough for cross-continental flights (a commercial jet would be better).
That's not to say a vessel that could travel in sea and space couldn't exist...but there would have to be a compelling reason for it to exist. For example, an ocean planet specializing in underwater mining and trades with other star systems may have reason for space ships to double as submersibles --- but even in this extreme case, those needing to be underwater (the miners) would not be the ones needing to be in space (the traders).
Such a vessel might exist as a toy for a very wealthy person, or a spy-fi gadget (like James Bond's submersible car--see below), or as an experimental craft in a research lab. There's almost certainly no reason for it to exist in common use because it would not be commercially viable.
You asked for thoroughness....
Qualification: I'm a graduate-level planetary scientist specializing in fluid/atmospheric dynamics and a lover of science fiction.
A more thorough answer depends on lots of things, but in terms of physics, it comes down to density, speed of travel, pressure, and technology.
Density and Speed of Travel
The denser a medium is, the more effort it takes to move through it. This is why it's easy to move through air, harder to move through water, and difficult to move through a thick mud (there are other effects at work, but density alone would be sufficient to explain those observations).
The faster you move through a fluid, the more it resists your motion.
In fluid dynamics, these effects are captured together in the concept referred to as "ram pressure". This "pressure" is the slowing force per unit area that an object moving through a fluid experiences and is generally proportional to the speed of motion relative to the fluid times the density of the fluid. Ram pressure is the force per unit area that an object experiences as it pushes away particles in a fluid it is moving through. To an expert, "ram pressure" is slightly different than "air resistance", but it's similar enough that you can probably think of them as the same in many situations.
When gravity causes a skydiver to fall faster and faster through the atmosphere, the atmosphere's ram pressure on the skydiver increases with speed (and very slightly as the atmospheric density increases closer to the surface). When the ram pressure times the cross-sectional area of the skydiver equals the force of gravity, the forces balance and the skydiver reaches terminal velocity.
Pressure
As others have noted, spaceships are built to withstand certain pressure conditions. They must withstand explosion (from internal air pressure) in the vacuum of space and equalized air pressure on the surface of a planet.
The surface pressure at a given point on the surface is literally equal to the weight per unit area of the atmosphere above it. The same is true underwater: the pressure at a given depth is equal to the surface pressure (one atmosphere) plus the weight of the water per unit area above that depth.
Here's where things get fuzzy:
Some planets, like Jupiter and Saturn, have very thick atmospheres. On one hand, a given world might have a really thick atmosphere -- in which case spaceships visiting the planet would be need to be built more like submarines to withstand the incredible pressure. On the other hand, the atmosphere might be thin, and the "ocean" might be of some exotic liquid that is less dense than water. In that case, submarines wouldn't need to be as heavily fortified against pressures because the pressure would increase with depth less than it does in Earth's oceans. In either of these two cases, submarines might look more like spaceships, depending on the depth they are designed for.
As others have noted, a thicker shell to protect a vessel from pressure extremes is heavier. The added mass would mean that propulsion systems would have to work harder. Thus a heavier ship would require bigger (or better) engines and/or more fuel -- both of which would add to the mass of the ship, which would require more fuel, and so on. For more information, read about the rocket equation.
Propulsion
- Jet engines would not work because they take in air (oxygen). They would not work well in the vacuum of space and would not ignite.
- Rockets work fine underwater in theory because they require no air (up to a limiting pressure) -- this is why they work well in space.
- Extremely high pressures would push the outside fluid into the rocket, totally overwhelming the rocket so that it could not force exhaust out the nozzle.
- Propellers work well underwater, but not in space because they work by pushing material backwards, which causes the ship to move forward. There's essentially nothing to push in space.
As far as futuristic and/or hypothetical propulsion systems, it depends on the technology, the density, and on the universe. Can faster-than-light engines work underwater? Ask the author/owner of the universe why or why not.
Transition Between Atmosphere and Ocean
A spaceship needs to be capable of entering an atmosphere smoothly from the vacuum of space. For this reason, many have struts to slow them down as they enter the atmosphere at tremendous speed and heat shields to dissipate the heat. This works because the density varies very slowly between the top of the atmosphere and the surface. Physically speaking, the slowly-increasing density means the ram pressure on the vessel varies slowly enough so that the ship -- and its occupants! -- do not experience a sudden and damaging deceleration.
Any vessel that travels from an atmosphere to an ocean will need to be built for the transition from the lower-density atmosphere to the higher-density ocean. Human bodies can handle the transition at low speeds, like when we jump into pool water from the side, but not at higher speeds, like when we belly flop from a high diving board 10+ meters above the surface of a body of water.
High Speed Impact: more potential for damage
Low Speed Impact: less potential for damage
This is because the higher speed increases the ram pressure. The ram pressure of the air is negligible, but the ram pressure as we hit the water can be painful! In exactly the same way, and for exactly the same reasons, any vessel transitioning between atmosphere and ocean would need to be built to withstand the sudden -- and potentially dangerous! -- increase in ram pressure that would slow the vessel down. The ram pressure is minimized when the surface area is decreased. This is why belly flopping (larger surface area ==> larger ram force ==> larger deceleration) hurts more than diving in with arms crossed at the chest and toes pointed down (smaller surface area ==> smaller ram force ==> smaller deceleration).
High surface area dive: more potential for damage
Low surface-area dive: less potential for damage
On Earth, a spaceship travelling more than a few dozen meters per second would break apart on impact if it tried to "dive" into the water, unless it were significantly more fortified than our current technology allows.
This effect would be more pronounced for planets with low-density atmospheres and high-density oceans, and it would be less pronounced for planets which have a smaller difference in density between the atmosphere and ocean.
Shape Considerations
Because the density in an ocean is very high, the ram pressure is significant. For this reason, our submarines have a streamlined shape to minimize the ram pressure and the drag.
Assume for the sake of argument-by-intuition that the International Space Station had engines and a strong enough hull to move around underwater. It is not in an efficient hydrodynamic shape and the engines would have to work very hard. Moreover, if travelling fast enough through the water, it's possible some of its components would break off.
Spaceships meant only for space do not need to have aerodynamic or hydrodynamic shapes because they do not travel through air or water. Example: the Death Star or orbital space stations.
Spaceships which land on planets need to be at least somewhat aerodynamic so that they do not burn up in the atmosphere or have parts break off. Example: X-wings in Star Wars or the USS Enterprise starship from Star Trek. The faster the atmospheric entry speed, or the greater the density gradient in the atmosphere (e.g. the greater the planetary gravity), the more pronounced this effect will be.
Some vessels, such as the TARDIS from the Doctor Who universe, can land on a planet without travelling through atmosphere or ocean. For this reason, they don't need to be aerodynamic or hydrodynamic.
Summary / Conclusion
Different vessels are built for different purposes. If a ship is built for a particular set of conditions (e.g. space-only, air-only, underwater-only), it can be optimized for those conditions. If a vessel is designed to experience very different sets of conditions, it is much more difficult to optimize the ship to both sets of conditions, so sacrifices (e.g. sub-ideal designs like higher mass ships) must be made. The more different these conditions are, the harder it is.
In theory, a car can be made into a submarine, but it would be neither a great submarine nor a great car:
A vessel can go in the air and on the ground, but it's neither a great car nor a great plane:
A plane can go into space, but it is neither a great plane nor a great spaceship:
These outlandish transport vessels attempt to make travel possible in just TWO different environments with a single transition. For a spaceship to travel underwater, it would need to be designed for water, air and space — THREE different environments with two transition regions.