Representations of the Poincare group, spin and gauge invariance
Whatever deserves the name ''particle'' must move like a single, indivisible object. The Poincare group must act on the description of this single object; so the state space of the object carries a unitary representation of the Poincare group. This splits into a direct sum or direct integral of irreducible reps. But splitting means divisibility; so in the indivisible case, we have an irreducible representation. Thus particles are described by irreducible unitary reps of the Poincare group. Additional parameters characterizing the irreducible representation of an internal symmetry group = gauge
On the other hand, not all irreducible unitary reps of the Poincare
group qualify. Associated with the rep must be a consistent and causal
free field theory. As explained in Volume 1 of Weinberg's book on
quantum field theory, this restricts the rep further to those with
positive mass, or massless reps with quantized helicity.
Weinberg's book on QFT argues for gauge invariance from causality + masslessness. He discusses massless fields in Chapter 5, and observes (probably there, or in the beginning of Chapter 8 on quantum electrodynamics) roughly the following:
Since massless spin 1 fields have only two degrees of freedom, the 4-vector one can make from them does not transform correctly but only up to a gauge transformation making up for the missing longitudinal degree of freedom. Since sufficiently long range elementary fields (less than exponential decay) are necessarily massless, they must either have spin <1 or have gauge behavior.
To couple such gauge fields to matter currents, the latter must be conserved, which means (given the known conservation laws) that the gauge fields either have spin 1 (coupling to a conserved vector current), or spin 2 (coupling to the energy-momentum tensor). [Actually, he does not discuss this for Fermion fields, so spin 3/2 (gravitinos) is perhaps another special case.]
Spin 1 leads to standard gauge theories, while spin 2 leads to general covariance (and gravitons) which, in this context, is best viewed also as a kind of gauge invariance.
There are some assumptions in the derivation, which one can find out by reading Weinberg's papers
Arnold Neumaier (Arnold.Neumaier@univie.ac.at) A theoretical physics FAQ