Is it possible to detect battery chemistry?
Maxim has a good article on the subject. They also (surprise, surprise) have some ICs available to implement their functions. 

The article talks mainly about using the Smart Battery System to control charging, but also has good info on how the different chemistries have different charging requirements. It doesn't discuss how to deal with an 'unknown' battery chemistry, so you may be out of luck.

You could consider putting a temperature sensor on the cell, but by the time the non-rechargeable cell gets hot it may already be too late. Also, a full alkaline will have a higher float voltage than a NiMH- or NiCd-equivalent (1.5V vs 1.2V) so you may be able to detect this and inhibit charging as well.