Yeah its something that is really not well explained. It can happen that there is no gold left in the pit, so an enemy may notice and "tell the boss" that its empty. You will see that if the icon above an enemies head is an envelope. If they escape with the envelope you loose as well.