Lungfish can breathe air directly -- granted, it can't really do much more than that, but then the point is that it shows that fish can develop the necessary modifications to adapt to life even outside water. It should be possible to imagine a creature similar to, perhaps even the direct ancestor of, the lungfish developing the same breathing technique (because, in so doing, it could "escape" a limited way onto land from predators, for example), and then developing still further modifications to make the most of that escape, and so on.
Much as Theland mocks it, though, you really do need a lot of time, or a lot of generations, to see this sort of process in action. The fossil record can give glimpses, but tracking the complete progress of a species across the eons is probably forever impossible.
Breathing in space, incidentally, is not a helpful analogy. Space is, after all, a perfect vacuum, so there is nothing there to breathe. The difference between air and water is still stark, of course, but rather less stark than between nothing at all and air.