Experience orbs do not appear if the player dies with gamerule doImmediateRespawn true.
1. Get some experience levels
2. Set gamerule
3. Check that gamerule keepInventory is false
4. Get killed
Notice that the experience orbs don't appear at the place of death at all after dying.