B, foam extinguisher can be used to put out common fires such as wood and cotton cloth, and its foam will damage books, so the choice is wrong.
C. Fire extinguishing with water will damage books and documents in the library or archives, so the option is wrong.
D, liquid carbon dioxide fire extinguisher will not leave any residue but will damage objects, and can be used for fire fighting in books, archives and other places, so the option is correct.
So choose D.