I think its a hard problem. And measuring pH won't work naively anyway as dissolved CO2 is in a slow equilibrium with dissolved bicarbonate (though certain enzymes if present speed this up enormously).
There are sensor systems out there, but no idea how expensive: http://uk.mt.com/gb/en/home/products/ProcessAnalytics/DO_CO2_Sensor/Level_2_CO2_family_NOV03/Carbon-CO2/InPro5000i.html
I suspect they only measure CO2, not bicarbonate, so that might be an issue depending on the application.
Mixing a small sample with Ca(OH)2 solution would cause CaCO3 precipitate which could be sensed by photometer perhaps? Have to filter out the gunk to get good optical clarity first though. Don't know how sensitive and repeatable that would be.