A martingale representation theorem and valuation of defaultable securities