Why is this unit randomly invulnerable?

Solution 1:

This is an effect of the Dementia trait. Occasionally you will encounter an enemy that is only in your head.

See my answer here for a full list of traits.