Earth’s atmosphere is really thin compared to the radius of the Earth. How big a hole do I need to dig before people suffocate?
—Sam Burke
The idea here is straightforward: When you dig a hole in the ground, the hole fills up with air.[1]The dirt you pile up outside the hole displaces air, so at first you won't have much effect on the surrounding atmosphere, but the effect grows as the hole gets deeper and the pile gets higher. So keep at it! If you dig a big enough hole, most of the atmosphere will flow in, and there won't be enough left outside the hole to breathe.[2]You need to remove about 65% of the atmosphere before sea level air becomes too thin to support human life.[3]As this paper points out, it's odd—and likely coincidental—that the highest point on Earth happens to be just about exactly as high as the human high-altitude survival limit.
The atmosphere's exact volume is tricky to define, since it gets thinner at higher altitudes and doesn't have a firm boundary. If you compressed the whole thing to the density of normal surface air, it would be about 10 kilometers thick, and take up a volume of 4 billion cubic kilometers. 4 billion km3 of air is enough to fill a cube 1,000 miles high, which is nearly the volume of the solid core of the Earth. That gives us a rough idea of the scale of our hole.
Digging a hole that big will be a challenge. Even a hole the size of Massachusetts would have to be deeper than the diameter of the Earth to fit the whole atmosphere at surface pressure. A hole the size of the entire United States would need to be 400 kilometers deep, much deeper than we could actually dig.[4]And if you tried to dig up the entire surface of the United States to any depth, people would probably yell at you.
But wait! Air pressure changes with height. Air pressure goes down as you rise upward, which you can sometimes notice when your ears pop while driving on a hill or riding in a tall elevator. By the same token, pressure rises when you go downward. The air pressure in a deep mine is much higher than the pressure at sea level.
It might seem like the increasing pressure would help us fit more air into the hole. The pressure should compress the air, so a deep hole should be able to fit more than its "fair share" of air. But it doesn't quite work out that way.
As you go deeper into the Earth, the rock gets hotter.[5]Citation: Amiel, J., Eckhart, A. E., Swank, H., (2003) The Core Under the ideal gas law, pressure compresses air, but heat causes it to expand. In the case of a hole in the Earth's crust, the expansion from the heat of the rocks can actually counteract the compression from the higher pressure. Calculations in this paper[6]This one is an actual paper and not a trailer for a terrible movie, I promise. show that temperature gradients of more than about 30°C per kilometer will result in no compression at all. If the temperature change is faster than that—as is common in areas with thin crust or volcanic activity—the density of air will actually drop as you go deeper, even as the pressure increases.
What if we compress the air some other way?
Diving tanks can contain air crushed by a factor of 200. A pile of diving tanks would only have to be a few hundred miles high to hold the entire atmosphere. If we want to compress air further, we can liquify it. Air is mostly oxygen and nitrogen. If we get air cold enough, it turns to a liquid with a density similar to water.
If we liquified the whole atmosphere—and for the record, I don't think we should—we could conceivably fit it all in the ground. We'd effectively need to remove a patch of the Earth's upper crust, exposing magma veins and pressurized chambers, and we'd have to somehow seal all those off and keep things cool enough that our storage tanks didn't melt.
The excavation would be a near-impossible challenge. But if you somehow solved all the countless engineering problems, you could—in principle—fit the entire liquified atmosphere of the Earth in a 5-mile-deep hole roughly the size of Texas.
Although you may not want to use that particular state.