Momentum in collisions and explosions
Total momentum before equals total momentum after whenever no external net force acts, even when kinetic energy is lost.
A worked example
A 3.0 kg cart at 4.0 m/s striking a stationary 1.0 kg cart and sticking to it gives 3.0 x 4.0 = 4.0v, so v = 3.0 m/s.
The mistake people actually make
Momentum is conserved in every collision in an isolated system, but kinetic energy is only conserved in an elastic one. Momentum is a vector, so opposite directions take opposite signs.