One of the most confusing aspects of plumbing, for the average person is where, how, and what is a vent. Let me start by simply telling you that the pipe or pipes penetrating your roof. Most likely is a plumbing vent. There may be a similar pipe up there that could be an exhaust for your furnace or water heater, but most likely it is a vent for your plumbing system. To be safe and legal every you need a vent. The main purpose of the vent or vents within your house, or any other building, is to prevent the possible siphon age of the P traps that keep the sewer gases out of the structure.
The U shaped pipe under your plumbing fixture is the P-trap. This is designed to stay full of water. Therefor “trap” the sewer gas behind it and not allow it to enter your home. Sewer gas can be anywhere from a stinky annoyance, to as much as a toxic danger. Without properly placed and installed vents. It is very possible that these traps can either be siphoned out by other fixtures.
Vents must me installed properly and at a precise location. Vents also serve other functions in the system, such as allowing fixtures to drain better. They also regulate positive and negative pressure balances. Especially in a larger building with very tall waste stacks.
The air admittance valve is a little device which can serve as a vent but does not have to penetrate the roof. These will allow air to enter when needed but they will not allow the sewer gas to escape. They have a very real drawback though, and that is they cannot relive positive pressure. These devices were invented and designed with the intent of solving some very tricky plumbing venting dilemmas. A real vent through the roof is always the best way to install a plumbing system.