The nozzle or exit hole for the pressurized gases is not just any opening. It is specially designed to open outward like an ice cream cone. This makes the gases exit even faster, which in turn, gives more push at the other end of the combustion chamber. Rockets do best in outer space where the gravitational forces are less and there is no air resistance to overcome. But, there is also no air to keep the rocket fuel burning.
Rockets work in space because they are completely self-contained.
This explains why Polaris missiles can be fired from submarines while they are underwater. The fuel and oxidizer can be in solid or liquid form. The huge rockets which hurl the astronauts and satellites into space use liquid fuels like kerosene or super-cold, liquid hydrogen and oxidizers like liquid oxygen. When the two liquids are sprayed into the combustion chamber, they ignite and burn with explosive force. At White Sands Missile Range, most of the missile systems under test use solid fuels and oxidizers.