I think there's a couple of factors in the pilot's unions objections to armed skymarshals aboard planes. (Bear in mind that arguments about guns tend to become irrational pretty fast, since both sides percieve it as a gut-level survival issue.)
First there's the notion that guns are just pure evil by themselves and allowing one on an airplane is the same as selling your soul to the devil, no matter what kind of reasonable rationale is behind it.
Second, unions and associations tend to expound the views of the people running them rather than the membership. For instance, every street cop I know is in favor of average citizens being trained and armed, but many police associations are opposed to the idea, usually because the leadership is politically oriented.