Under what conditions does loot despawn?

Solution 1:

To my knowledge only white loot despawns (this includes things like ammunition) and while I don't know how long it takes specifically it is possible to tell by looking at it. The item steadily shrinks in size until it basically disappears. So yes, it does seem to be based on time.

I'm fairly sure items rarer than white (green, blue, purple, E-tech, orange, obviously) don't despawn. I've left them lying in open chests before and come back ten, 15 minutes later and still seen them lying there. I'm not certain about them being on the ground though, if you take them from the chest then drop them again they may have exactly the same "shrinking away into nothingness" time as white items.