People who have panic attacks hyperventilate.. they are usually told to breath into a paper bag.
There are several potential causes of hypercapnia. It may result from hypoventilation, diminished consciousness, lung disease, rebreathing air, or exposure to an environment high in CO2 (e.g., near a volcano or geothermal vent or under in some workplaces). It can also occur when supplemental oxygen is administered to a person with sleep apnea.
Rebreathing air previously exhaled into a face mask over and over again gradually increases the concentration of CO2 and reduces the concentration of oxygen that actually gets into the lungs. Each exhale adds a higher level of CO2 to the air that remains in the face mask between breaths, accelerating this process.
Hyperventilation, whether from a panic attack or otherwise, would be rather opposite from hypercapnia, with CO2 concentration in arterial blood too low. Thats why breathing into a paper bag helps, to increase the CO2. level in the blood.
Here is a good article on CO2 to help understand it's effect on respiration.