A pact that helped the tech giants and others send personal data from the EU to the US has been ruled invalid.