In the US, yes. Our first amendment to the constitution carves out a special protection for churches. Churches reject marrying heterosexuals all the time for reasons ranging from psychological maturity to previous divorces to basically any reason they want to. We even have precedent for churches being allowed to deny marriage to people who are protected against discrimination when it comes to employment and patronage at businesses. There are independent congregationalists churches in the south that occasionally make the news for refusing to marry interracial couples, and no legal action is taken against them.
What legalizing gay marriage means in the US is that gays can get married by a judge at a court house, and by any religion that chooses to perform gay marriages (Like the Unitarian Universalists, who endorse gay marriage). Religions that don't want to perform gay marriages don't have to. We're seeing that they don't have to right now, as 30+ states now have gay marriage and there has not been even one case I've heard of where a church that refuses to perform them gets in legal trouble.
I am not familiar enough with Irish law to know if it's the same there or not. I would assume so, but I don't know for sure. One would think the Catholic Church would still have enough pull in Ireland to get an exemption if it's not explicitly granted .
In the US, a vote to force religions to marry gay people against their beliefs would be invalided in court. The constitution trumps other law.
A bakery is a public accommodation, like a restaurant or a hotel. They do not have the same special protections we afford to churches and other religious meeting places performing religious rituals.