At least in 3.5, the SRD doesn't directly address environmental sources:
I've frequently seen it extended to 'external sources of physical damage'. So, something falling on you doesn't hurt, but if you fall into a pit or cut yourself, you take the full damage. Certainly, that's a house rule/interpretation.A creature with this special quality ignores damage from most weapons and natural attacks. ... The creature takes normal damage from energy attacks (even nonmagical ones), spells, spell-like abilities, and supernatural abilities.