Not sure what you mean by "defensive." I can be quietly defensive about personal space but it's very rare that I openly push anybody away, shut them out, or walk out on them. I'm more likely to make an excuse or just slip away and hide, or pretend I'm not at home if there's an unwanted knock on the door.
There are many times when I'd rather like to be alone but can't find a diplomatic way of escaping or removing the intruders. So I tend to just absorb the inconvenience and hope they'll either go away or some polite way out of the problem will emerge. When that doesn't happen quickly enough I can eventually get rather fraught and then I have to battle with myself to avoid turning nasty. Of course I'm only talking about people I have any respect for. If it's an evangelist or any other kind of marketer, and I don't know or like them (I rarely like evangelists or marketers), I tend to forget I'm a gentleman.
An ex-wife had a habit of being around me way too much. That got to be a hell of a strain, and eventually my verbal behaviour towards her deteriorated quite badly, which probably helps to explain why we split up. But I was much younger then, and I was carrying some emotional baggage from a previous relationship. My current wife and I frequently get walled up alive together in a tiny living space for a long time, but we remain mellow to each other. It can be a strain, but we're both fairly non-invasive and easy to live with, and it works out well. We spend a lot of time in our own individual worlds even though physically we might be side by side.
I think I sometimes unconsciously signal that I don't want people's company. I don't quite know how that works. I suppose it's body language.
There was a guy at work who, when he'd had enough of you, would start giving you a running commentary about what he was working on. That way, he was getting his work done, and the pressure was on you to either let him be or tolerate the one-sidedness of the subject matter. I'd soon get bored and leave him to it. No idea whether he was conscious of his strategy or not.