Is it legal for a private entity to found a space colony?
Ex. Build a rotating habitat in orbit around the Earth and let people live there indefinitely
The Outer Space Treaty represents the basic legal framework of international space law and, among its principles, it bars States Parties to the Treaty from placing nuclear weapons or any other weapons of mass destruction in orbit of Earth, installing them on the Moon or any other celestial body, or to otherwise station them in outer space. It exclusively limits the use of the Moon and other celestial bodies to peaceful purposes and expressly prohibits their use for testing weapons of any kind, conducting military manoeuvers, or establishing military bases, installations, and fortifications (Art.IV). Moreover, it explicitly forbids any government from claiming a celestial resource such as the Moon or a planet. Art. II of the Treaty states, in fact, that “[o]uter space, including the moon and other celestial bodies, is not subject to national appropriation by claim of sovereignty, by means of use or occupation, or by any other means.”.
This question and its answer(s) ("What lunar legalities are currently in place") will inform somewhat concerning the moon itself, and furthermore refers to the United Nations Office for Outer Space Affairs, which has reportedly been more active in recent years.