Yeah, the metaphor “coffins of black” represents innocence, which we can justify by the fact that the speaker was sold as a slave in this poem, mentioned as:
And my father sold me while yet my tongue
Could scarcely cry” ‘weep! ‘weep! ‘weep! ‘weep!”
So your chimneys I sweep & in soot I sleep.
We later see this metaphor in the poem in form of a question:
Were all of them lock’d up in coffins of black.
In this line, it describes a confined life of sweepers, who have nothing else to do in life except sweeping.
Now, let’s see another use of this metaphor:
And by came an Angel who had a bright key,
And he open’d the coffins & set them all free;
Then down a green plain leaping, laughing, they run,
And wash in a river. and shine in the Sun.
In the following stanza, coffins stand for loss of innocence, as an Angel comes to free the sweepers from confinement and they are happy to leap, run and laugh.