These kind of problems with a 3 years old are quite easy to handle once you have had a parenting workshop. And no, you can't solve it with spanking - nor time out or any punishment for that matter. (Not that solving it with punishment is desirable even when it "works", considering the major side effects it has on the parent-child relationships and on a child's self esteem).
The solution lies in switching gear from the confrontation mode to the listening mode.
Stop the threats, take a deep breath until you feel calm again. Then, lower yourself until you are at your child's height. Lock your eyes into her eyes, make a warm smile, nod a little, touch her lightly and say something loving and tender that she can relate to, such as: "Hey, I see you are quite upset...". All of this is called "collecting the child", it allows the connection to be restored and draws the child's attention to the parent, better than any punishment, yelling or spanking will ever do. Once the parent has the child's full attention, you can now start what child counselors name "active listening". Try to identify the problem, how she feels, the emotion that she feels, and name it: "You seem REALLY angry right now. ". As she respond, reflect back the emotion she might be feeling. If she hits you more, continue: "You are THAT mad? Here, take this pillow and show me how mad you are on it." (or give her a pen and pad and tell her: "Show me on this paper how MAD you are at me."). This gives the child other ways to diffuse her anger and it teaches her to use words and communicate in other ways than hitting. There is no point lecturing her until she can hear you, and she cannot hear you until she feels YOU heard her.
Continue doing this until she calms down. Then continue reflecting back her communication. Now the goal is to go fishing for the root of the problem. She might say: "I don't want to go to kindergarten!" then you reflect it back, but you try to guess what it really means for her: "You REALLY don't like to go away from me and mom, do you?" and she will correct if you didn't hit the spot. You will know when you have found the root cause, because she will be really relieved, will cry or hug you, or will be really demonstrative. Now you know the WHY. The next step is to address the why. Explain why. Reassure her. Find creative ways to address her underlying need.
Finally, the fourth and last step is to teach her about the hitting. You can only do this now that she is calm and that her root problem was addressed. "You know honey, you did hurt me earlier.. it's not very nice. I understand why you did it. But next time, instead, try to TELL me okay?" (and proceed with teaching words for emotions: this should be done with little games everyday, such as showing her cartoon faces with different emotions and asking her to name them).
Learn more on my parenting portal, on www.parentastic.org
Good luck!
ConsciousSoul