I understand your frustration. I need alone-time to write and it is essential for my well-being that I get that time (my way to work through my past). My husband doesn't like it. He'll come into the room "to just read a book here, I'll be quiet" or check what I want for dinner or whatever. I think he calms his own fears about losing me (even if I only distance myself for the hours I'm writing) by checking in on me and re-establishing contact.
I can't say we have worked it out completely, but between talking about it (emotional connection) and it just happening kinda often (getting used to it) it got better over time. I also get less upset when he comes in. I just ask him to give me some space and give him an approximate time for how long. Not engaging emotionally helps me to find my focus again quickly.
If none of this works, I think I'd just try to find a space outside of the house to be alone when I need to be.