As Sam Hopkins comments, the short answer to the stated question is "yes, all the time." You'd be hard-pressed to find a professional mathematician who hasn't received a referee report that basically boils down your first paragraph. Often, the referee or editor can't find anything mathematically wrong with the result, but they reject the paper on the basis that it's not at the right level for the journal, meaning the result or techniques used are not interesting or novel enough, in their view. Essentially, this means they think the work could have been done by many people but wasn't really worth the effort.
The rest of the OP seems to be asking about whether or not it matters if someone else has tried and failed. In fact, it does matter, and it makes the paper more likely to be published if someone else has tried and failed, rather than less likely as the OP suggests.
Let me give you a concrete example. In 2017, my coauthor Donald Yau and I wrote the paper Arrow Categories of Monoidal Model Categories. This paper was published in 2019 in Math Scandinavica. In it, we proved a fact that I would not normally have thought would be worthy of a paper in its own right. However, because the statement had been left as an Open Question by a well-known mathematician in the field (Mark Hovey), we were able to frame the paper as "answering a question of Mark Hovey" and I think that probably helped it get published.
For an example in the other direction, my co-author Michael Batanin and I wrote a paper, Left Bousfield localization without left properness, that I think is definitely worthy of a publication. It shows how to side-step a problem that has bedeviled mathematicians in the field for a long time, and has zillions of examples illustrating the power of the approach. However, because it was left as a remark (4.13) in a paper by Clark Barwick, it has been much harder to get this paper published. I got a rejection that essentially boiled down to "Clark Barwick knew how to prove this and didn't think it was worth writing down."
It is worth noting that the paper in question was one of Clark's earliest, and he later wrote a great essay about The Future of Homotopy Theory where he lamented this kind of thing. He wrote:
We do not have a good culture of problems and conjectures. The people at the top of our field do not, as a rule, issue problems or programs of conjectures that shape our subject for years to come. In fact, in many cases, they simply announce results with only an outline of proof – and never generate a complete proof. Then, when others work to develop proofs, they are not said to have solved a problem of So-and-So; rather, they have completed the write-up of So-and-So’s proof or given a new proof of So-and-So’s theorem. The ossification of a caste system – in which one group has the general ideas and vision while another toils to realize that vision(6) – is no way for the subject to flourish. Other subjects have high-status visionaries who are no sketchier in details than those in homotopy theory, but whose unproved insights are nevertheless known a
conjectures, problems, and programs.
He even includes a side-note saying
(6) only to have their paper rejected with lines like the following, from a colleague: "After So-and-So’s [sketchy] work, it was essentially obvious that such a result would be possible, given the right framework."
So, based on that, I have to conclude that if he had a time machine, Clark probably would have written his Remark 4.13 as a Conjecture and then I could have published my paper saying I "proved a conjecture of Clark Barwick." I confess that I'm guilty of very much the same kind of behavior. I put a paper on arxiv in 2014 announcing a result that wasn't on arxiv till 2017 and one researcher told me my remark discouraged him from working on the project. I regret that. Nowadays I try to put many more Questions, Conjectures, and Problems in my papers, e.g., this one that just got accepted for publication.
So, to conclude, I call upon anyone who has read this far to include named/numbered Conjectures, Questions, and Problems, and at all costs avoid Remarks where you claim things are true but don't write out the proof. Let's make the field friendlier to young people and help them get their work published, while at the same time incentivizing them to build on our work by answering questions we explicitly leave. I wrote something before to this effect here.