You must understand that preschoolers, just like adults, sometimes have bad days and want nothing more than to be on their own. Her teacher might have reprimanded her about something, that toy that she so badly wanted to play with just didn’t come her way - whatever it is, a cuddle from you right now will just not fix her problem.
Her problems might seem trivial to you as an adult, but to your child they are very real and have the same effects on her that your problems have on you. The best thing to do at these times is to respect her wishes and let her know that you are there for her. Once she has finished sulking you can be sure that she will come and look for attention from you.
You have disciplined her and told her to go to her room. Later on you want to make up with her by giving her a cuddle, and she pushes you away. Her response is exactly the same as yours after an argument with your spouse - you also need time to let off steam before talking to him/her. Your child is angry with you and needs time to think things over before getting any attention from you. Let her know that you’ll be there for her, and that you still love her, even though she has done something wrong.
Your child could also reject your affection for some underlying reason. For instance, if you have been away on a business trip, when you get back home, she refuses to talk to you. She is angry and upset that you were not at home, and really does not know how to express herself, except to not talk to you.
At two years old your child might be going through an independent phase. She is growing up and needs you less and when you want to cuddle and kiss her feels that you are interrupting her learning time. Do not take this too seriously she still loves you and might not need as many kisses and hugs from you right now, so save your cuddles for when she is not so busy. She knows that you love her, and will let you know when she is in the mood for a cuddle.
There are times when she will be really eager to cuddle her mommy and play up with her dad, or vice versa. It is quite normal for children to go through phases of favoring one or the other parent. It could be that, without realizing it, you are actually encouraging this favoritism. For instance, do you always seem annoyed when your husband gets home from work and smother your child with affection? Or, does your husband perhaps want your child to run into his open arms, when in actual fact your child prefers to do things slowly?
Then again, it could very well be that, while you enjoy lots of affection that your child is not like this at all. Every one is different, and your child might only look for attention at certain times, such as when she is afraid or upset. If this is the case with your child, then she will look for affection from you when she is ready.
If your child is normally very affectionate and suddenly becomes distant with you and pushes you away, it could be that she is ill, and if this carries on, it might be a good idea to visit your doctor.
Sometimes things can get out of hand though. Instead of just pushing you away when you want to kiss and cuddle her, your child becomes violent and resorts to hitting and biting you. This kind of behaviour is totally inappropriate and should be dealt with immediately. Give your child time out in her room to think about what just happened. After a cooling down period, talk it through with your child, and explain to her that such violent behaviour is not acceptable, and that she will not get a good response from you should she act this way again.