You just have to tax on import and un-tax on export.
Or directly tax the things that cause it: Tax all non-biofuel petrol a certain amount instead of trying to calculate how much CO2 was emitted in its production.