Federal court in Virginia says officials were trusted to ‘speak for the trees’ as it tosses out pipeline permit