The Wells-Riley equation, which is used to model the risk of indoor airborne transmission of infectious diseases such as tuberculosis, is sometimes problematic because it assumes steady-state conditions and requires measurement of outdoor air supply rates, which are frequently difficult to measure and often vary with time. We derive an alternative equation that avoids these problems by determining the fraction of inhaled air that has been exhaled previously by someone in the building (rebreathed fraction) using CO2 concentration as a marker for exhaled-breath exposure. We also derive a non-steady-state version of the Wells-Riley equation which is especially useful in poorly ventilated environments when outdoor air supply rates can be assumed constant. Finally, we derive the relationship between the average number of secondary cases infected by each primary case in a building and exposure to exhaled breath and demonstrate that there is likely to be an achievable critical rebreathed fraction of indoor air below which airborne propagation of common respiratory infections and influenza will not occur.