Couldn't open device
Restore a DMG (maybe an OSX InstallESD.dmg or any other application) to the disk/drive via Disk Util. This will overwrite it (deleting all data). Then you can partition again how you like.

I have encountered this several times myself with USB pen drives as well as SSDs inside a MacBook Air. Formatting and Erasing brought up the exact same errors you describe. DD didn't work out, Resizing the partition gave me an error about corruption on the disk. First Aid/Scanning &amp; Repairing the volume didn't yield any results, the tool completed with the message that there wasn't anything to repair.

Only the Restoring of a random DMG to the drives made it manageable again.

Hope this helps!