italy
Italian Constitution prohibits this. In particular there are the following articles that deal with it:
Art. 23.
Nessuna prestazione personale o patrimoniale
puo` essere imposta se non in base alla legge.
Art. 24.
Tutti possono agire in giudizio per la tutela dei
propri diritti e interessi legittimi.
La difesa e` diritto inviolabile in ogni stato e
grado del procedimento.
Sono assicurati ai non abbienti, con appositi
istituti, i mezzi per agire e difendersi davanti ad
ogni giurisdizione.
La legge determina le condizioni e i modi per la
riparazione degli errori giudiziari.
Art. 25.
Nessuno può essere distolto dal giudice natu-
rale precostituito per legge.
Nessuno puo` essere punito se non in forza di
una legge che sia entrata in vigore prima del fatto
commesso.
Nessuno può essere sottoposto a misure di sicu-
rezza se non nei casi previsti dalla legge.
Translation (taken from the official English translation available on Italian Senate website).
Article 23
No obligation of a personal or financial nature
may be imposed on anyone except by law.
Article 24
Anyone may bring cases before a court of law
in order to protect their rights under civil and
administrative law.
Defence is an inviolable right at every stage and
instance of legal proceedings.
The poor are entitled by law to proper means
for action or defence in all courts.
The law shall determine the conditions and
forms regulating damages in case of judicial
errors.
Article 25
No one may have their case removed from the
court seized with it as established by law.
No one may be punished other than by virtue of
a law in force at the time the act was committed.
No one may have their liberty restricted save for
as provided by law.
So in general these article prohibit that a private agreement could go against the law, even if all the parties involved sign a contract without being under duress or coercion.
In particular our civil code has an article (art.1418) that explicitly regulates when a contract is intrinsically void (sorry for not being able to cite the text, but it links to a host of other articles of the code and general law concepts).
For example, one of those articles is art.1346 which states:
L'oggetto del contratto deve essere possibile, lecito, determinato o determinabile.
Translation by me (emphasis mine):
The object of the contract must be possible, licit, determinate or determinable.
So this article renders void contracts where you, for example, renounce a civil right.
NDAs are possible, though, if their object is determinate. In other words, you can legally agree to avoid disclosing informations (e.g. specific trade secrets), but you cannot agree to renounce your free-speech right or to renounce the right to call the authorities if you discover some illegal behavior covered by the terms of the contract.