I think it's important to draw a distinction between 2 parts of an attack.
- Can a creature spend its action swinging at the mage hand?
- Can the mage hand be affected by an attack?
Can a mage hand be attacked?
The answer to the first part is, of course, yes. A mage hand is visible (unless you are an arcane trickster or have a similar feat). A creature being pestered by the hand may not know that it is a magical effect and may spend its turn swatting at it or trying to attack it.
As far as whether or not someone could target the hand with a spell, Xanathar's Guide to Everything (p 85) has the following:
If you cast a spell on someone or something that can’t be affected by the spell, nothing happens to that target, but if you used a spell slot to cast the spell, the slot is still expended.
Either way, since it does not have an AC, the attack would automatically miss, or the attack would go right through the hand just as if it was an illusion.
Can a mage hand be affected by an attack?
Mechanically, no. A mage hand is a magical effect. It is limited to its description. It has no AC and no HP. It cannot take damage.
Although not written in any official source, Mike Mearls, the senior manager for the D&D research and design team, agrees with this assessment. When asked what happens when a mage hand is attacked, he replied with:
nothing - mage hand can't take damage or really affect the environment beyond what spell says
But, I don't like that
That's the beauty of D&D. The rules are meant as a guideline, so you can make up whatever rules you want for the game. Create an AC, HP, and any immunities/vulnerabilities etc. that make sense. To quote Mike Mearls again, he suggested:
if I allowed attack, I'd say AC 16, hp = to caster's level + casting mod, immune to everything but force damage
Can a mage hand be attacked? yes
Can a mage hand take damage? no