you're looking for the Treaty of Algeron...
The treaty reinforced and redefined the Romulan Neutral Zone, and made clear that any violations of the Zone without adequate notification, by either side, would be considered an act of war. The treaty also expressly prohibited the development or use of cloaking device technology by the Federation. Then-Captain Pressman attempted to circumvent this clause in 2358 with the test of a phasing cloaking device developed covertly at least in some part by Starfleet Intelligence aboard the USS Pegasus.
As far as i know, there's never been an actual reason why the Romulans demanded The Federation not to use cloaking technology... it's just part of Trek history that's never been explained
So the Federation signed a treaty that applied different rules to the Federation than the Romulan or Klingon Empires. This is kind of like the United States agreeing not to use submarines while allowing the Soviets to continue using them during the Cold War. I can't imagine the Federation Representative being well thought of for signing this treaty. Can you imagine how many Starfleet personnel could have lost their lives when their ship came under attack by a cloaked Klingon or Romulan vessel, and those that survived cursing under their breath the signers of that treaty that put them at this disadvantage to begin with?