Rocket fuel burns in space because it brings along its own oxygen. Rocket propellant, as it is generally called, consists of both a fuel and an oxidizer, that oxidizer contains the oxygen necessary for it to burn in space and also have very high energy rapid combustion.
Often oxidizer is pure liquid oxygen that burns with kerosene or liquid hydrogen, other times it is a different chemical that burns with others such as hydrogen peroxide, gaseous oxygen, dinitrogen tetroxide, or red fuming nitric acid (no longer in use).
Each component of the propellant is stored in different tanks and therefore only mixes once it is inside of the rocket engine. Some rocket propellants combust on contact, others require some sort of activation energy to get going, such as a spark or a flame.