If the idea is interesting enough, and the reason why it doesn't work is also nontrivial and interesting, then I would say this is definitely publishable, with bonus points if you can use the combination of idea-plus-no-go-theorem to shed some new light on aspects of the problem which have not been unearthed before.
Basically, I would propose as the key criteria to frame this decision:
- How likely is it that someone else will come up with that idea in the near- or mid-term future? How likely is it that a literature search will save them a significant chunk of time?
- To what extent do the techniques you use to prove your no-go theorem add new tools or insights into the theory?
If you think that the answer to either of those questions is positive, and you feel confident that you can convince both editors of reviewers of that answer, then I would say that you should go ahead and try it. (Of course, this involves a huge judgement call, and reasonable people can disagree about both of those answers. If you're in doubt, consult with colleagues before going ahead.)
In fact, one of my papers (this one) arguably falls into that category: there was this existing observation from experiments ("there is an asymmetry in the harmonic emission doublets") and we came up with what we thought would be an excellent way to explain it ("if you analyze from a rotating frame, there are ionization-potential shifts which simplify the ionization dynamics"), but it turned out that in the full analysis the simplification brought in by this idea is exactly cancelled out by some non-intuitive effects.
Of course, that's not the whole story, and there are a bunch of conceptual insights into the configuration and the overall theory that fall out of the analysis, as well as some concrete experimental predictions, so you can't cleanly say that the idea-plus-disproof by itself is what made the paper publishable. But then, I would argue that if the work is nontrivial enough, then it will rarely be the case that you can cleanly separate the idea-plus-disproof from the conceptual insights added by the paper, and it is the latter that can really make it publishable.