Proof that it does not work is still an interesting result! However, I think you meant to say that if you failed to show that it works, it often also means you cannot proof that it doesn't work. And then you indeed have nothing worth publishing.
Say you're researching some material to have some behaviour. It doesn't have it.
You're not gonna be published on high impact journals with data that doesn't move the field, even though as you point out the information is as valuable.