Planets with a Planet Quality (PQ) of 0 are not the same thing as barren worlds. You can never colonise PQ 0 planets. Barren and other extreme environment planets always are at least PQ 1 (just like normal habitable planets), but have a small icon on their side, designating their hazardous nature. The icon is red, if you don't have the necessary technology to colonise this type of world, yellow, if you have the basic technology, and green, if you have the advanced technology.
You can always colonise habitable worlds (or extreme worlds you have the technology for), no matter the current relations with the owner of the territory they are in.