I can see how frustrated you are. Let's try to figure out what's going on here.
It's perfectly normal for toddlers to appear rebellious -to say "No!" a lot, to kick up a fuss over small things, to refuse to cooperate, even to hit or throw things. It's not a reflection of a problem with your relationship or anything to do with you at all. It's simply a matter of their emotional development. They are learning the nature of power and are experimenting with how they can use their power.
At the same time, young children value attention from us so much that they'd rather be punished by us than ignored. That's why spanking her didn't change anything -it actually reinforced her behavior because she got extra attention from you. Spanking also lets her know that it's OK for one person to hit another when she's feeling frustrated.
So the first thing you should do is realize that you're not the cause of her behavior; it's a matter of biology. When she hits you, tell her "No! Don't hit!" in a stern voice. Then simply look away from her (ignore her) for about 15 seconds. That's a much more powerful deterrent at this age than spanking. Also, when she's behaving nicely, pay extra attention to her. That will help solve the problem.