Sad for you, but things like that happen.
Something that might help: Usually, there is a note in a paper making transparent when it was initially submitted, when a revised version was submitted and when it was accepted for publication. If the other paper was accepted after your initial submission it is obvious that you could not have known the contents of that paper. In that case, as a neutral observer it is nice that two independent papers describe similar findings, i.e. reproduce the results. In that sense, your paper is worth publishing in any case.
You might be able to use this as an argument in a possibile discussion with the editor. However, there is a realistic chance that neither the reviewers nor the editor have heard of the other paper, so will not ask for any information in this direction.
Of course it would be best practice to make your current knowledge transparent to the editor anyway and maybe include some discussion about the other paper in your own paper. If I was the editor, and if the other paper was discussed properly, I would probably accept the paper for publication, given there are no other reasons not to do so (but this is my opinion).