How do you open the barred doors in the Binding of Isaac?
The doors are tied to your health. The door will only be open if you have full health. However, the temporary HP boosts (blue hearts) can serve as a equivalent of the missing red hearts.
For example: If you're missing one red heart but have one blue heart the door will open. But if you're missing two red hearts and only have one blue heart the door will still be locked.
The doors of Challenge Rooms are tied to your health:
The normal doors will only open if the sum of your current HP (counting red, blue, and black hearts) is at least equal to the number of red-hearts-containers you have.
The boss doors (recognizable from the skull they have on the door head) require the player to have only one red heart at most, but the amount of blue and black hearts are not taken into account. It is best to enter them with a Full Health pill, or with plenty of blue/black hearts (the health gambling machines can be used to reduce the amount of filled red-heart containers while keeping the blue and black hearts intact).