This requires more justification than I am currently giving it, but it is easy to find examples of math problems that don't have even a tenuous connection to reality (I have also noticed that some pure mathematicians nevertheless argue that it does; their arguments are so weak that I can only conclude that they are trying to retroactively justify a decision they already made, and I am saying this as someone who has published papers in the field in question). The source of examples I am most familiar with is (a large portion of) enumerative combinatorics. It is possible that this is the only example, but I suspect that if I was more familiar with algebraic number theory then I could make a similar claim there.
For what it is worth, the last time here I tried to give an example of something in algebraic number theory not mattering to reality it turned out that it actually had some sort of practical purpose.
Upon further reflection, I don't think I can justify my claim that these sorts of problems have no connection to reality at all; perhaps a better claim is that these problems are a very inefficient way of making headway on problems that we care about, even if we extrapolate into the far future. But this would be a much subtler and difficult claim to justify, so for now I'm editing my above post to retract this statement. Since you quoted it in your response, people will still have access to it if they care.
For the past few days I've been pondering the question of how best to respond to paulfchristiano's recent posts and comments questioning the value of mathematical research. I don't think I can do it concisely, in a single post; bridging the inferential distance may require something more like a sequence of posts. I may end up writing such a sequence eventually, since it would involve ideas I've actually been wanting to write up for some time, and which are actually relevant to more than just the specific questions at issue here (whether society should sponsor mathematics, and given that it does, whether paulfchristiano or anyone else in the LW readership should pursue it).
However, as the preceding parenthetical hints at, I'm actually somewhat conflicted about whether I should even bother. Although I believe that mathematical research should be conducted by somebody, it's not at all clear to me that the discipline needs more people beyond those who already "get" its importance, and are out there doing it rather than writing skeptical posts like paulfchristiano's. It seems perfectly plausible to me that those who feel as paulfchristiano does should just leave the profession and do something else that feels more "important" to them. This is surely the best practical solution on an individual level for those who think they have a better idea than existing institutions of where the most promising research directions lie, at least until Hansonian prediction markets are (ever) implemented.
Nevertheless, for those interested in the society-level question of whether mathematics (as such) may be justifiably pursued by anyone, or any community of people, as a professional occupation (which is quite distinct from the question of whether e.g. paulfchristiano should personally pursue it), I recommend, at least as a start, grappling with the arguments put forward by the best mathematicians in their own words. I think this essay by Timothy Gowers (a Fields Medalist), titled "The Importance of Mathematics", is a good place to begin. I would particularly draw the attention of those like paulfchristiano, who think they have a good idea of which branches of mathematics are useful and which aren't, to the following passage, from pp.8-9 (unfortunately the illustrations are missing, but the point being made is pretty clear nonetheless):