The official website for The Settlers of Catan

Question about Barbarians & Traders Merchants’ Residences (general) - Is a city required for building a Residence?

Answer

Yes, because a city is required for building the Harbor you must own.