This paper extends the roommate problem to include externalities, allowing preferences for a partner to depend on the situation of others. Stability concepts for matchings and partitions of the set of agents are proposed and characterized, conditional on all agents having prudent expectations about other agents' reactions to deviations. We prove that any roommate problem with externalities has a stable partition and that a stable matching exists if there is a stable partition without odd rings. These results allow us to find restrictions on the space of preferences ensuring the existence of a stable matching. We also show that some classical properties are lost in the presence of externalities: the existence of paths to stability from any unstable matching, the coincidence of the core with the set of stable matchings, and the invariance of the set of agents who are alone in a stable matching.