LibSBML does not support chemical formulas for species

Yes, this is true. You can not store metabolites chemical formulas directly in SBML. I have seen various approaches, like, adding chemical formula to the name of the metabolite or storing formula in the htmlNotes tags.
I have been struggling to find an appropriate way to read&write chemical formulas in SBML files until my recent correspondance with authors of libSBML.

Quoting Sarah Keating:

The most robust way to currently store this information is to use a miriam compliant annotation to point to a database/resource that specifies the formula. Section 6 of the SBML Level 3 Version 1 Core specification details of this type of annotation and libSBML provides an API that allows users to interact with the annotation via a class CVTerms (see the addCVTerms example).
Directly adding chemicalFormula to the Species element is being facilitated by the SBML L3 Flux Balance Constraints package (http://sbml.org/Documents/Specifications/SBML_Level_3/Packages/Flux_Balance_Constraints_%28flux%29). LibSBML does provide “experimental” support for this package.