A Nebraska judge on Wednesday struck down a law that allowed the Keystone XL oil pipeline to proceed through the state, a victory for opponents who have tried to block the project.