On modern cars, the fuel tank is semi-sealed. Air can indeed escape, but only into evaporative emissions control system (charcoal canister). A valve that is controlled by engine load and RPM will vent fumes out of the charcoal canister and into the engine's intake to allow the gasoline vapors to be burned rather than just allowing them to escape into the air.
On older cars, the fuel tanks are simply vented to atmosphere. The changeover from this method to using evaporative emissions controls happened during the early 1970's.
ZV