How to publish a paper that does not seem to be within the scope of any journal?
Interdisciplinary papers have this problem a lot. A - now - very influential paper in my field, I was told by the first author, was in limbo for 4 years before it was published, despite the senior author being world-famous.
Persistence is the key. Try to find someone influential who is knowledgeable and you can convince to help you expanding/adapting/explaining the work better and you could then co-submit with. Or else, you could consider aiming for a general-purpose journal such as PLoS ONE, and whose reviewers are advised to select by novelty and correctness, rather than (subjectively judged) relevance.
Learning to write for the specific audience of a journal can also help.
Here are some suggestions to get your work published, that may or may not apply to your case – you have to judge for yourself.
Ask the journals
When submitting a rejected paper to another journal, it is often recommendable (and some journals even require it) that you detail to which journals you submitted your papers before and why they rejected it. In your specific case, this may lead to editors being more lenient regarding the scope, in particular if we are talking about sister journals and even more so, if they aspire to cover the entirety of a given field.
If you did not do this, I recommend writing to both journals you submitted to so far and inform them that the respective sister journal also rejected the paper for being out of its scope. At the same time, you can ask the respective journals to recommend a suitable target journal.
Another possibility that you have to consider is that declaring the paper off-topic was an easy way out for the editors to deal with a paper they didn’t really know what to do with. So it may be that your paper does have some relevant flaws that were unmentioned. If you write to the journals as suggested above (and if you do not make any accusations in this direction), they may give you some hints as to what you can improve.
Ask your private reviewers
Another inspiration for journal selection may come from the professors who privately reviewed your paper. If it pertains to their field, they should be able to recommend you a journal. At the same time, you can ask them whether there is anything they would change about the paper to adapt it to the journal they suggest.
Split your paper
This is a standard technique used by my interdisciplinary surrounding: Publish a methods paper (or similar) in a more theoretical journal and then publish an application paper in a more applied journal. A major problem of an interdisciplinary paper – even though never said explicitly – may be the journals have no idea who could review it (this problem would even arise with mega journals). Remember that they need to find a number of people who have sufficient knowledge of all relevant fields and they have to accept to review. Splitting your paper may allow each part to be reviewed by experts of the respective field and thus solve this problem.
To go a little further than Captain Emacs's answer: even for people doing non-interdisciplinary fields, it's pretty common for nice papers having trouble finding a venue. One important conjecture in my field (and has motivated a lot of my personal research) was made 30 years ago and remains unpublished because the author had trouble getting it accepted and eventually gave up.
In addition to persistence being important, I want to add: browse journals for similar kinds of papers.
I also had trouble getting one of my papers published because it was on a novel type of problem, which both makes it hard to gauge interest and makes it hard to find appropriate referees. The first journal we submitted to had it refereed by someone in another field who didn't seem so interested in the pure mathematical aspects. Then we tried a couple of other journals (including one recommended by an editor of a previous submission) who said it wasn't a good fit and/or couldn't find referees. After looking around again and browsing a lot of papers in various journals, we finally found an appropriate one. Yay!
Also, in order for editors and likely referees to be able to properly understand it and find it appropriate, you may need to rewrite it for the intended audience of the journal (Cap. Emacs' last point). Again, browsing papers in the journal will help you get a better sense of the intended audience.