Like most words, space has more than one meaning, and we must use contextual reasoning to work out which is intended.
You're thinking of the meaning of space which is a mass noun: that is, uncountable, which is why the article seems misplaced to you.
For example, this is how Merriam-Webster (MW) defines the uncountable space you're thinking of:
space (n, uncountable): the boundless three-dimensional extent in which objects and events occur and have relative position and direction
However, it is the very presence of the article in your text which serves as a clue that that's not the definition being employed here.
To the contrary, because there is an article, the intended meaning must be some kind of count noun. Thus, we refer back to our dictionary, and look for definitions of space which not only fill that role in the sentence (i.e. be count nouns), but also make sense in context.
To remind us of the context:
A person who suffers from claustrophobia has a dread of being confined in a small space,
So the space under consideration must be limited (or the claustrophobe could not be confined to it), and it must be possible to have more than one of them (again, the article establishes that we're dealing with a count noun).
So, returning to Merriam-Webster:
space (n, countable): an area that is used or available for a specific purpose
That looks quite suitable: first, it is a count noun, because it's described as an area (did you notice that area can be a count noun too?), and second, it is set aside for some particular purpose, which in our case, is to confine the claustrophobe.
We can get further corroboration by looking at the subordinate glosses:
a limited extent in one, two, or three dimensions : distance, area, volume
an extent set apart or available
Again, we see articles before extent in both subdefinitions, and now we're explicitly told that the space is both set apart and, crucially, limited. That is, it's capable of being small.
The key takeaway here is not that space can take an article sometimes, but the more important lesson that when you're surprised or confused by a particular usage, it's always best to first check a dictionary to see if there are any senses for the word you were previously unaware of.
And I can tell you that this happens even to native speakers, and we use the same strategy. Surprised (baffled!) that anymore can be used in a positive context? Check a dictionary and learn that one of its meanings is nowadays.