You know how dogs sometime teleport into the ground? Well, I've noticed that some mobs do it to. It's most common with slimes, but sometimes they'll spawn and glitch into the ground. This actually makes them invulnerable, yet they can still hurt the player. To reproduce try going into a swamp biome and you should get a slime or two in the ground if you haven't already seen a mob spawn in the ground.
Related issues
Comments


HOW DID YOU FIND THAT?! I think the quick search needs to be updated...

I wonder how you didn't, that issue is the second most popular, see https://mojang.atlassian.net/browse/MC#selectedTab=com.atlassian.jira.plugin.system.project%3Apopularissues-panel
Duplicate of MC-119.