If you walk into our 5-year-old granddaughter's room while she is playing with her dolls, she will tell you "I want time alone" and if you do not leave within several seconds she will look at you in a mean way and in a horrible voice tell you to "Get Out!" My husband and I will be visiting her in a few weeks. Do we as grandparents discipline her? How do we handle this?
Defer to her parents in all things.
While I can absolutely agree that behavior like this, particularly when expressed in such a rude fashion is unacceptable, there are a few things you have to consider.
You are there temporarily. Her parents are there permanently. Any change you attempt to enact via discipline or other interventions will not stick, because you will not be there to enforce it (and presumably the parents will not either).
There may be factors in play that you do not understand, given that you do not live with your children or grandchild. While you could attempt to understand these factors, again, you will not be there in a lasting capacity to act upon them in a helpful way.
Any attempt to enforce change is going to be disruptive, especially if her parents are not on board. This could cause her to resent you, and cause her parents to resent you for 'meddling'.
So as well-meaning grandparents, what can you do?
Ask for guidelines from the parents.
Hey, I noticed Susie can be very abrupt when insert unwanted behavior here. Is she like that when we're not here? Is there something I could be doing differently? How would you like me to react when she insert unwanted behavior here.
This allows her parents to inform you of factors I mentioned in #2, and gives agency to the parents to guide your behavior. This will clarify the ground rules at the parent's house, and give you firmer ground when the negative behavior occurs. Notice the lack of the accusatory 'you' in the question--it's entirely focused on what you as the grandparents ought to do, not what the parents should be doing to curb this behavior.
Don't go into her room.
Seems simple enough, but allow her the control over her personal space. She is starting to assert herself, and any corrections to this ought to be handled (or not, as they choose) by her parents. Note what situations appear to be trigger points, and use them when you have conversations with her parents.
The important overall message is that her parents have primary authority over her and her behavior. Your authority and ability to discipline or guide your granddaughter should be entirely guided and informed by her parents and their wishes. While you might not agree with them, her parents have chosen to raise her in a certain way which does not reflect on you or how you brought up her parents, but is rather an expression of their lives together as a family unit.
Ignore and remove if confronted.
If the child acts like this in other situations, I'd imagine it's perfectly acceptable to say, "I don't like being talked to in this way," and turn to give your attention to something else. Note that this only applies in situations where you are not the 'aggressor', meaning you are in an open space such as a living room or family room. This doesn't apply to the bedroom situation. But I would caution you to speak to the parents first as you already know there may be flash points for their daughter.
Talk to her parents.
You should respect her desire to play alone. I would suggest a protocol: If her door is closed, you leave her be. You can try to lure her out:
"I'm making cookies. Want to help"
"I'm going to the library. Want to come"
If she says, 'no' respond, "Ok, see you later." then go do what you said you would.
You do need to deal at some point with her rudeness. I think she is escalating from a request to outrage too quickly.
Especially since you are talking about a short-term situation, I would just leave it at handling it by showing self-respect. Calmly say, "Please talk to me nicely. I'm sorry for coming in; I didn't realize you were having some alone time. I like it when you tell me I've made a mistake so I can do it differently next time, but I don't like getting yelled at." or "Okay, I'm sorry. I don't like being talked to that harshly, so next time, please say, 'Grandma, I'm having alone time right now.'" I would also mention it to her parents, primarily in case they haven't seen her snap at people like that and also so you all can present a unified approach. They may also have some good suggestions for how they deal with it.
I have a bit of a different opinion from the other answers. If it were me I would make it clear that children should respect adults. It would also be made clear that when a guardian is in charge, in absence of parents that not only is respect required, obedience is as well.
I would explain that if she wants alone time she needs to address the reason I entered in the first place and then politely ask 'Can I please be alone for a while?'. Maybe you want to ask whats for dinner. Maybe you want to make sure obligations like homework or getting ready for bed are met. I don't believe that any child should be able to demand either space or alone time.