Hi J.,
My son went through this exact same phase - children hit because they don't know how to handle their feelings of anger. Sometimes they don't have the words to express their frustration, or sometimes they are overwhelmed with emotion and lash out physically.
The most important thing in my opinion is never to hit the child as previously suggested. If you look at it from the child's point of view, you're trying to teach them not to hit, and then to accentuate the point you hit them. It's contradictory and sends confusing messages to the child.
My son is now 3 and we go through stages where he's perfect and cute and wonderful, and then he'll start challenging us and pushing the limits. He wants to see where he fits in and how much power he holds. It's completely natural behaviour. It's very frustrating and infuriating at times, but we just grit our teeth and be as consistent as we can with our messages to him.
When he was around your daughter's age there were a few things we did to discourage hitting. First, we told him in no uncertain terms NOT to hit. I'd say, "We do not hit - hitting hurts," and used time out as punishment. I have to admit that I used to think time out was ineffectual and stupid, but if it's used properly it's a very powerful tool. Again, consistency is the key.
For time out we'd put him on a stool in the middle of the room so he couldn't distract himself by playing with anything (even the walls or the rug), then let him sit it out for a minute. We would stay in the same room and either my huband and I would talk to one another, not acknowledging him, or I would continue doing some chore where he could see me but not interacting with him. At the end of that minute I would then kneel down to his level and ask him, "Do you know why you are in time out?" and he would tell me, then I would ask him to apologize, tell him I love him and give him a hug and a kiss. He is always sincerely regretful after having some time to think about it.
Another tactic is to involve your husband - if your child hits you, your husband should say to your daughter, "We are a family and we love one another, we do not hurt one another. You hurt Mommy and that is not okay." That tells her that her behaviour was not acceptable, but at the same time it shows her that she has a place in your family and your relationship is based on love. Again, it sounds corny, but it really works.
It is very important for children to know where they stand and that they are loved. Everyone wants a place to belong, and with children still figuring out the world and not having the ability to communicate like adults do, this is even more important. We emphasize to our son all the time that he is part of our family and what he feels matters to us. That way if we do have to discipline him, he doesn't feel like we are separating ourselves from him, he knows that his behaviour was wrong but that he is still loved by us. My husband calls it the "team". He says, "We're a team, so we need to stick together!" We do a lot of things as a team, supporting one another, and it gives our son a real sense of identity in the family and a lot of confidence when dealing with difficult situations.
Last but not least, suggest other ways to express her frustration. If she's verbal, encourage her to tell you she's angry and why and what she wants you to do about it. If she's not verbal, tell her to vent her anger by yelling. You can couple this with telling her that she can only yell outside, then open the front door and let her have at it. It got to the point with my son that I would tell him something he didn't like, he'd get this really mad look on his face, wordlessly stalk to the front door and wait for me to open it so he could put his head outside and yell. It was really hard for me not to laugh because it was so serious to him! It works for children and animals, too - not too long ago a goat pulled my son's hair and rather than him being eternally terrified of goats, I had him go tell the goat why he was mad. He yelled, "Don't bite my hair, goat! I don't like that!" and laughed afterward. I think he realized how funny it was!
Come up with other acceptable ways for her to vent, and if she tries to hit you, stop her gently and firmly tell her no - raise your voice but do not yell, then suggest an alternative. By simply saying "No" to children we don't give them a solution to the problem that caused the reaction in the first place, so supply one.
The other thing concerning discipline in general that I've found works is simply telling the child that you are the parent, they are the child, and they must listen to you. I know it sounds wacky, but just making that clear really sets the boundaries in place for the child. Then they can explore and grow within those boundaries without fear or anger. It worked well in our situation.
Now that my son is older and we can discuss his behaviour, if he is not listening to me I will say, "I have asked you nicely, and I am not going to ask you again," and he'll do what I asked of him. He knows I'm serious without my having to resort to yelling or threatening harm. When he's at daycare he deals with other children by saying, "I don't like it when you hit me!" and then he'll leave the situation. He yells sometimes, but he never hits back. There is the occasional push, I'll admit :) When he gets really angry he'll say, "I am frustrated!" or "I am angry!" and that opens things up so we can talk about it. When he yells at my husband or I, we tell him that he cannot yell at us becuse we are his parents and again, just saying that works. We then of course encourage him to tell us in a quieter tone of voice what is bothering him so he doesn't keep those feelings bottled up.
In any case, I know dealing with a child that hits is very hard and sometimes embarrassing (especially if you're in public or around relatives). If you are around other people, pick her up and take her somewhere quiet where she doesn't have an audience. Just find what works best for you, BE CONSISTENT, be loving, and it will all work out.
Good luck!