This paper develops a structural model that determines default spreads in a setting where the debt's collateral is endogenously determined by the borrower's investment choice, and a demand variable with permanent and temporary components. We also consider the possibility that the borrower cannot commit to taking the value-maximizing investment choice, and may, in addition, be constrained in its ability to raise external capital. Based on a model calibrated to data on office buildings and commercial mortgages, we present numerical simulations that quantify the extent to which investment flexibility, incentive problems, and credit constraints affect default spreads.