Airlocks serve as the entrance and exits to spaceships, whether it is docking with another ship or for extravehicular activity (EVA), without compromising the atmosphere of a spaceship. They consist of a hyperbaric chamber with a pair of airtight doors, one allowing access to the ship's interior and the other to the vacuum of space. The chamber can be pressurized and depressurized in a controlled fashion
Throwing someone out a spaceship or space station's airlock without a suit, or as some universes call it, "spacing," or simply "airlocking," is a common method of killing / executing.. Union Fleet uses this as accepted method of execution. By all accounts, getting exposed to the hard vacuum of space is not a pleasant way to die.
While so called Membrane force fields are commonly used, there is always a mechanical, physical door that can be closed.
An airlock is a device which permits the passage of people and objects between a pressure vessel and its surroundings while minimizing the change of pressure in the vessel and loss of air from it. The lock consists of a small chamber with two airtight doors in series which do not open simultaneously.
An airlock may be used for passage between environments of different gases rather than different pressures, to minimize or prevent the gases from mixing.
An airlock may also be used underwater to allow passage between an air environment in a pressure vessel and a water environment outside, in which case the airlock can contain air or water. This is called a floodable airlock or an underwater airlock, and is used to prevent water from entering a submersible vessel or an underwater habitat.