If you filed chapter 7 in 2005 and your house was foreclosed on in 2007 do you have to pay taxes on it?

If the foreclosure was not part of the bankruptcy, yes.