I've encountered a case where the unit refused to attack. In the image, my gal is standing behind an enemy, and can't attack with the handle (or punch).
The enemy is clearly seen, stands there (blocks movement/clicks), and attacks target & hit it as expected.
There is a platform above and below, so the enemy can't accidentally be on a different Z level.