The ST universe predominantly only depicts two main races with cloaking technology: the Romulans and Klingons. In universe, the Klingons originally got the technology from the Romulans as part of a treaty.
Therefore, the only races we've really seen that have developed the technology from first principles are the Romulans and the Federation (in TNG:Pegasus) (Particularly as this device was interphasic, making it different to regular cloaking devices as used by the Romulans and Klingons, it seems likely that the technology was independently developed, or at least improved, by Starfleet).
In the DS9 episode Homefront, it's speculated that the Dominion may have recovered a cloaking device from the combined Romulan/Cardassian fleet that attempted to invade the Founders' home world. It was barely even considered that the Dominion may have developed the technology itself, even though the Jem'Hadar have personal cloaking devices, making the possibility that they have developed ship-size cloaks at least plausible.
There are other technologically superior races (such as the Borg) that also don't seem to have ever developed the technology as far as we're aware of.
Given that most major races are more-or-less technologically on a par - warp drives, transporters, phasers/disruptors are ubiquitous for example - in universe, what makes cloaking technology so rare?