I had this problem recently and had to try several times to wipe and reformat the disk using disk utility, and finally was able to use internet recovery to download and install a new copy of Mountain Lion (the original OS) and then upgrade back to Sierra. What a pain. Plan C was to boot from a Ubuntu flash drive and use the Ubuntu disk utility to unmount and erase Macintosh SSD. The whole problem happened because I tried to restore my computer without disabling Filevault first. It should have worked fine since I had the disk password but something went awry.