Jim- The basic law that prevents there from being perpetual motion machines is the Second Law of Thermodynamics. Crudely put, it says that energy always flows from large-scale organized mechanical modes into small-scale disorganized ones, like the thermal jiggling of atoms. That is as true in space as it is on Earth.
Friction between things which are moving with respect to each other provides one of the main ways that energy gets dumped into those small scale modes. In space, there's not much atmosphere around, so (under some circumstances) air friction can be reduced. So one of the paths for losing mechanical energy can be slowed down, but the direction of the flow will not be reversed.
p.s. On a minor technical issue, the viscosity (a measure of how much friction is produced at low relative speeds) of a very rarified gas is actually about the same as the viscosity of a dense gas. For large, slow-moving objects, even the rarified atmosphere doesn't reduce friction much. For objects moving rapidly through the gas, like satellites, the density does matter, which is why low-orbit satellites have more problems with friction than do high-orbit ones.
One other spin on the subject:
The impossible kinds of perpetual motion machines are those from which you can extract usable energy and the system continues exactly the same way as it did before the energy was extracted, providing an infinite supply of energy. These certainly don't exist. But systems in which the components are constantly in motion and never slow down do in fact exist. The electrons in orbit around the nuclei of atoms are in effect little perpetual motion machines, at least in one construe of what those words mean, because they are perpetually in motion. But energy cannot be extracted from motion of such electrons if they are in the "ground state" (and most atoms are) because there are no lower-lying energy states allowed by quantum mechanics. If the electrons are not in the ground state, you can extract useful energy, but then the atoms go into lower energy states until they reach their ground state, from which no further energy can be extracted.
It is similar for a more macroscopic object in space. If it is not moving with respect to the (very low pressure) ambient gas, then there will be no friction. All you have to do then is to observe the object in a frame of reference which is moving with respect to it, and it will be seen to be perpetually in motion. Conservation principles also insist that motion never stops for some things. For example, conservation of angular momentum insists that the galaxy will keep spinning, even if it dissipates its energy through friction to the surrounding gas, the gas and what's left of the galaxy at that time must still rotate.
(published on 10/22/2007)