You can buy smaller bags of dirt if space is an issue, but a 20lb bag of dirt requires MAYBE a 2ft x 2ft space at the most. You could toss it up on a shelf. Throw it in a corner, put it under your kitchen sink, tie it up and slide it under your bed.

There are tons of places you can put a 20lb bag of soil. If you go to some nurseries you can even get smaller bags of soil.

I lived in a very small apartment and I had room for my grow cabinet and a place to keep my dirt/nutrients.