Which is what bouncers on nightclubs, hotels avoiding certain wedding receptions, etc, etc do every day of the week
Its when someone feels compelled to give a religious lecture to the person they're refusing that they end up in court over it - that's what happened in the bakery.
The cake situation is still going through the courts so its rather premature to state they weren't breaking the law.
You do not have a right to refuse business if you state a reason that is protected under law - which they did. Had they just said no with no reason, there'd be no court case.
My brother's suggestion was that businesses should be allowed to discriminate on "conscience" - but would have to put massive signs in their window saying they do so. I've a feeling that there wouldn't be many...