In a shared house (one with roommates) is it breaking the law if one enters the bedroom another without his permission? What if the door is closed? This is not taking any lease into consideration.
Trespassing occurs when you enter someone's land or property without permission.
At common law there must be some notice given to you that you do not have permission; otherwise, permission can be implied. A closed door would be such notice, so would a sign on an open door saying "No trespassing" or equivalent or your roommate telling you in the past to "Stay the f*&k out of my room!".
Permission can be circumstantial, an invitation to enter to e.g. fetch their car keys is not a general invitation. It can also be revoked.
Typically lease contracts are an agreement between the lessor (owner of the property) and (all) the lessee(s) on the entirety of the leased property. These contracts typically require any amendment to them be made in writing. Since the agreement leases the entire house to the lessees, each lessor should have access to the entire leased property. Thus no trespass is committed if such circumstances apply.
In circumstances without a written contract a lease still must exist, be it verbal, otherwise there would be no legal access to the land. Unless otherwise specified this would usually give access to the whole property to each tenant.