Kinetic approach to chemical reactions and inelastic transitions in a rarefied gas