Spain's constitutional court declared the Catalan referendum illegal and hundreds of people were injured as police used force to try to block voting.