Heterotopia is a concept elaborated by philosopher Michel Foucault to describe certain cultural, institutional and discursive spaces that are somehow ‘other’: disturbing, intense, incompatible, contradictory or transforming. Heterotopias are worlds within worlds, mirroring and yet upsetting what is outside. Foucault provides examples: ships, cemeteries, brothels, prisons, gardens of antiquity, fairs, Turkish baths and many more. Foucault outlines the notion of heterotopia on three occasions between 1966-67. A talk given to a group of architects is the most well-known explanation of the term. His first mention of the concept is in his preface to 'The Order of Things' and refers to texts rather than socio-cultural spaces.
Heterotopia follows the template established by the notions of utopia and dystopia. The prefix hetero- is from Ancient Greek ἕτερος (héteros, "other, another, different") and is combined with the Greek morpheme τόπος ("place") and means "other place". A utopia is an idea or an image that is not real but represents a perfected version of society, such as Thomas More's book or Le Corbusier's drawings. As Walter Russell Mead has written, "Utopia is a place where everything is good; dystopia is a place where everything is bad; heterotopia is where things are different — that is, a collection whose members have few or no intelligible connections with one another."
Foucault uses the term "heterotopia" (French: hétérotopie) to describe spaces that have more layers of meaning or relationships to other places than immediately meet the eye. In general, a heterotopia is a physical representation or approximation of a utopia, or a parallel space (such as a prison) that contains undesirable bodies to make a real utopian space impossible.
Foucault explains the link between utopias and heterotopias using the metaphor of a mirror. A mirror is a utopia because the image reflected is a 'placeless place', an unreal virtual place that allows one to see one's own visibility. However, the mirror is also a heterotopia, in that it is a real object. The heterotopia of the mirror is at once absolutely real, relating with the real space surrounding it, and absolutely unreal, creating a virtual image.
Foucault articulates several possible types of heterotopia or spaces that exhibit dual meanings:
Foucault's elaborations on heterotopias were published in an article entitled Des espaces autres (Of Other Spaces). The philosopher calls for a society with many heterotopias, not only as a space with several places of/for the affirmation of difference, but also as a means of escape from authoritarianism and repression, stating metaphorically that if we take the ship as the utmost heterotopia, a society without ships is inherently a repressive one, in a clear reference to Stalinism.
Human geographers often connected to the postmodernist school have been using the term (and the author's propositions) to help understand the contemporary emergence of (cultural, social, political, economic) difference and identity as a central issue in larger multicultural cities. The idea of place (more often related to ethnicity and gender and less often to the social class issue) as a heterotopic entity has been gaining attention in the current context of postmodern, post-structuralist theoretical discussion (and political practice) in Geography and other spatial social sciences. The concept of a heterotopia has also been discussed in relation to the space in which learning takes place. There is an extensive debate with theorists, such as David Harvey, that remain focused on the matter of class domination as the central determinant of social heteronomy.
Mary Franklin-Brown uses the concept of heterotopia in an epistemological context to examine the thirteenth century encyclopedias of Vincent of Beauvais and Ramon Llull as conceptual spaces where many possible ways of knowing are brought together without attempting to reconcile them.
New Media scholar Hye Jean Chung applies the concept of heterotopia to describe the multiple superimposed layers of spaciality and temporality observed in highly digitized audiovisual media. A heterotopic perception of digital media is, according to Chung, to grasp the globally dispersed labor structure of multinational capitalism that produces the audiovisual representations of various spacio-temporalities. 
The concept of heterotopia has had a significant impact on literature, especially science fiction, fantasy and other speculative genres. Many readers consider the worlds of China Miéville and other weird fiction writers to be heterotopias insofar as they are worlds of radical difference transparent or of indifference to their inhabitants. Samuel Delany's 1976 novel Trouble on Triton is subtitled An Ambiguous Heterotopia and was written partly in dialogue with Ursula K. Le Guin's science fiction novel The Dispossessed, which is subtitled An Ambiguous Utopia.