I think the general procedure is that XP is assigned as a total to each encounter when it is created by the DM. Each monster, trap, hazard, etc has an XP value, but that value is primarily used to budget the encounter. The XP award for the encounter is the total sum of the XP of the components, but it is awarded for defeating the encounter, not particularly for each PIECE of the encounter separately.
This is not a perfectly hard and fast rule, but it makes sense. Suppose the party attacks a group of orcs and kills some of them, but then has to retreat. Even the orcs tthey did not defeat contributed to the difficulty of the encounter. Of course they wouldn't get full XP in such a case, and maybe NONE depending on how much they hurt the orcs and what the goal of the encounter was, but they should probably get more than just the value of whichever orcs they did kill.
With traps and hazards the XP value is assuming that the trap or hazard is a significant part of the encounter. If it isn't, then it should not count in the XP budget when building the encounter, and won't count in the reward either. Of course it could count at a fractional value. If the acid pit is not really likely to be a significant danger, but it is POSSIBLE for someone to fall in if they are really unlucky or dumb, then maybe it counts for 1/4 of full value or something like that.
I think the general concept with traps would be if you can just basically ignore it and not set it off, then it isn't a major encounter element. You'll get XP for it, but it would be counted at some reduced rate. OTOH if the trap is a key part of the encounter and the party STILL manages to avoid it, then that is just as good as disarming it or surviving setting it off.