Some applications (notably: Messages) have their icons disappear when a notification is received.
When it happens an empty space in the dock appears and neither the icon nor the badge show up.
For some reason, this behaviour does not happen on the Mail & Preferences programs.