Explain the problem to someone that doesn't know anything about it. Usually that 'clicks' at some point and I realize what I'd been missing all along. The less the person knows about computers/programming (my usual subject matter) the better it seems to work.
One person plays the rubber duck and sits there and says (at most) "uhuh, uhuh" while the programmer with the bug explains the problem. Nine times out of 10, the bugged programmer will do a facepalm and fix the bug immediately while explaining the problem.
You actually don't need a person at all for this, or a rubber duck... just the willingness to explain your bug aloud to yourself when you have one.