The men blow up some houses but they are very near to the fire. 'It is no good,' says Pepys to the soldiers.

==============
In the second sentence, what does 'it' refer to?

That is the very general, introductory use of "it" in which there is no antecedent. It's just introductory, just as "there" and "here" are sometimes used at the beginnings of sentences.