Many good answers have been given, but this seems like the kind of question that deserves some diversity in reality checks, and right now, I'm all up for giving unpopular opinions.
sharing a break room for at least half the day
I'm not familiar with many workplaces where people will use a break room for that long. I understand this to be some resting place where people go when they're not expected to do actual work. To my knowledge, only some very physically and mentally demanding blue collar jobs have this characteristic. And if you perform mentally demanding work, you should understand that there people around you who are likely mentally exhausted. Compound this to the fact mentioned by others that for introverts, socializing can be further exhausting, and I believe you have plenty of reasons why some people may not engage in small talk every day.
"Some days we will literally chat for an hour about nothing important."
If that applies during breakroom/lunch time, then fine. But to my standards, something is quite wrong with people who engage with non-work chat for more than 30min per session, especially if this is a recurrent rather than an extraordinaire event (but I have 1 hour lunch and 5min coffee breaks in general). When this is commonplace, I generally think that at least one party in the conversation needs more work to do, and I hope the other party is not sacrificing his own social life by staying late on work after losing one hour in a non-important conversation, and god forbid the company is paying overtime to people who engage in useless small talk for that long very often.
That being said, it seems like the problem is mostly related to the relationship you'd like to build with this person.
Probably, you should start promoting out-of-workplace events, to create situations were people are supposed to socialize rather than doing actual work. You'd be amazed at how much some people change when they are wearing shorts and slippers rather than a business suit and because there is a beer on their hands. This generally helps people being more at ease between them. You may still have issues with the non-drinkers, or people who never happen to be available, but it's worth a few shots here.
How can I handle it better when this happens? Why do so many men often do this? How do people not realize how rude they are?
Let me give my standard reference again, so each person can think what is correct or appropriate in each person's culture. If I go grab a coffee at a break room, I should greet everyone there with some simple words, like "hey, how are you?". And I should respond to any person that directs me their word, which does not mean engaging in conversation. If someone asks me "how was your weekend", a simple "it was fine" is enough courtesy talk. Though I can and sometimes will engage in telling my awesome weekend adventures and misfortunes, that will depend on the relationship I have with the asker, and how much work I am supposed to to that day, and how generally busy I believe the asker to be. Body language clues are often a good giveaway here: People pointing their feet to the exit of the coffee room are not the ones I'm expecting to hijack for a conversation. Likewise, I've been known to always be walking comically fast on the company's corridors (it's my common walk speed and I am generally very busy).
So, if this standard fits your complaint, please understand my opinion that I don't think people are being rude. They can and perhaps should be friendlier though, but that is a different matter.
If it helps copying with the situation, try being more understanding. In general, think that it is not about you. Everyone has a struggle you may know nothing about. These middle-age colleagues of yours may be stressing over their hair loss (which in turn brings more stress), or their nagging wives that complain about their hair loss or their kids who don't believe they need passing grades at school because they want to be game streamers. All of this is out of your control and causes them to have difficult days, when they simply can't take their minds out of their problems to engage in chit chatting with you.
In some cases, you may start to worry: If someone is just never in the mood, he may be suffering from some kind of depression, so inform yourself and keep alert for signs of it. Maybe ask HR to make a "general survey" on the mental health of all people in the company, they should know how to find but not expose those who indeed need help.
I think the solution is to change my attitude and remain optimistic for a better day tomorrow.
No. I don't think your attitude needs to change, you are correct in being friendly and talkative, though others are not wrong to not meeting your socializing quota.
Also, no. Don't be "optimistic for a better tomorrow". This is creating unrealistic expectations for your workplace, and unrealistic expectations are a sure path to the frustration you are reporting. Try to be understanding of other people so when they behave normally (and up to my standards, their behavior seems normal) but "in a bad day normally", you should be able not to take offense or emotional suffering from it. Hence, by adjusting your expectations and empathy, this should cease to disturb you.
Maybe one day you'll be in a magic place with all the friends you love at your workplace with long several hours breaks filled with enthralling conversations that happen every day and every time. But some people follow the 3 stages of growing up from the Spongebob show. You can and should do everything to avoid reaching the third stage, but over time, everyone has their Squidward days, just don't let they take you down. It is just neither their intention nor worth your sleep hours.
All that being said, you might happen to be in a situation where someone in the company dislikes you as a person or some stances you take in your conversations. People who talk a lot often make disaffections along the way. Honestly, it's a small price to pay for being yourself and satisfying your socializing needs. There shouldn't be anyone who hates you, but there might be a person who simply disagrees with everything you may have to say about some sensitive subject. Pundits are the extreme example: Some people love hearing them talk, and they amass large audiences in their social media, but lots of common folks would be disgusted if they needed to engage in a conversation with one of these every day. In a personal example, I myself get annoyed with people who always talk about sports (none of which I'm interested) or video games I don't play. People who talk about their bad airport experiences may also sound elitist for people who never get to travel, and people with pets are extremely annoying for people who hate animals (and they do exist). So maybe just take note if some subject plucks a string on some people and avoid these topics to prevent grunt-based responses.