Yes, in theory, prior restraint is illegal, although Attempted Suicide laws are only the most blatant example of an exception.
The wikipedia article mentions several, but perhaps the most pernicious is the Invention Secrecy Act:
So, got an unlimited, free energy source? Too bad, that would disrupt the economy. A new kind of car engine that runs on grass clippings? Nope. A super-efficient Stirling engine (operates on heat difference; high efficiency means you need less heat difference, i.e. 20 feet underground vs ambient temperature in winter or summer)? Not a chance.The Invention Secrecy Act of 1951 (Pub.L. 82–256, 66 Stat. 3, enacted February 1, 1952, codified at 35 U.S.C. §§ 181–188) is a body of United States federal law designed to prevent disclosure of new inventions and technologies that, in the opinion of selected federal agencies, present a possible threat to the national security of the United States.
The U.S. government has long sought to control the release of new technologies that might threaten the national defense and economic stability of the country.
There are around 5,000 inventions covered by the law, which is known from FOIA requests, and the declassified ones were defense related (cryptography and such), but there are persistent rumors that many of the older ones are energy related. One was a new kind of antenna; too good, it turns out, since it could pick up stealth aircraft against the cosmic background radiation, but you had crappy cell phone antennas for 8 years because of this law, and the guy who invented it got screwed.
Anyone want to do some research on the best countries to file a patent in for this kind of thing?