If a foul that comes with an LOD is accepted, even if the yardage is declined, the LOD can not be. B can accept the result of the play, or accept the foul and have the LOD enforced.
As AB and Curious have noted, whether the foul is accepted or declined, the play ends in the end zone, so a safety will result either way.