We, as humans, require an atmosphere containing .2 atmospheres of oxygen, or we die. Less, and you asphyxiate. Much more and you also die. We evolved on a planet whose atmosphere contained 20% oxygen and 79% nitrogen, and its pressure of 760 torr has become our standard "atmosphere" unit.
But let's say that you're in a fixed environment. Maybe this is because you're in space. Maybe this is because you're so insufferably paranoid about a gas attack that you seal your living quarters airtight. Maybe you have been bricked up in a forgotten cellar somewhere, for the love of God, Montresor!!
Okay, what normally happens is that the air in your closed environment begins to collect carbon dioxide from your exhalations until it reaches a level poisonous to you, at which time you die of it. If you somehow scrub the air of carbon dioxide, then you very slowly use up the oxygen until it's all carbon dioxide in your scrubber, and you asphyxiate.
However, the oxygen we breathe is not the original atmosphere of the Earth. When the earth was formed, its atmosphere was made of nitrogen, methane, and carbon dioxide. The first life used the methane and carbon dioxide, and produced oxygen. As pollution. The environment absorbed the first production, until the concentration exceeded the environment's ability to absorb it, until it poisoned the atmosphere, nearly killing everything. Worse for the first type of life, a new type of life developed in this environment that ate that first type of life for food and metabolized it with oxygen. We are the descendants of this second type of life which we call "animals." The first type, "plants," are still around, but have gained considerable complexity since those early days.
Okay, we could then, if we provide the plants light, use plants to keep us alive, but let's say we don't want to do that directly. Plants live in dirt. They need watering, and can spill. They make pollen, which many people are allergic to.
Okay, so we keep the plants in a separate greenhouse, where if we spill a little when watering, no big deal. Also, if they spew pollen, no biggie. We can filter this out of the air when we return it. Your living area is in one place with a HVAC system that blows air about, and it moves old air into the greenhouse. In the greenhouse, air is blown about over the plants (who will enjoy human-breathed air, rich in CO2 and water vapor), and who produce oxygen. Plant-breathed oxygen can be blown back into the HVAC system, heated or cooled to a good temperature for humans, and brought back to the human-living area. There should be a HEPA filter in the input -- we've separated the plants from the humans for a reason. Dust, pollen, and dirt might be great for plants, but we don't want them in the human-living areas. NASA has found that the average human uses the same amount of oxygen as produced by 400 plants. Since plants produce no oxygen at night, we should double this to 800 plants per human. This sounds like a lot, but it can be achieved with 12 liters of algae.
So now I have the perfect setup for a human-carrying space ship (or bunker for an absolutely crazy person), but I want to go farther: I want to ensure that the human quarters gets only oxygen, and the greenhouse gets only carbon dioxide. I can think of a few ways to accomplish this.
Carbon dioxide turns to liquid if compressed to 10 atmospheres of pressure (at "room temperature.") The liquid can be drained off and reexpanded in the greenhouse. Or, it can be cooled to -78, which will deposit it as a solid material, which I can put in the greenhouse to warm up. If I take a great deal of air from the greenhouse into a tank first, then seal off the greenhouse after a major load, I can maintain an oxygen gradient. Of course, I would want to have at least two greenhouses in use for this kind of system. When one is "filled," we start pumping the carbon into the other one. At no time is a greenhouse exhausted of carbon, or the living quarters below 18% oxygen.
Oh, and it is important to immediately remove dead plants from any of these setups. Dead plants use up oxygen as they decay.