Well I am not very good with the grammatical terms, so I cannot give you a technical explanation, defining what is what. But I think I can help you understand how the idiom " I beg your pardon " is used here (to be fair, I am not very sure of the concept of idiom). Since you mentioned that you need the context of " I beg your Pardon" specific to the song " Rose Garden", it will help you a lot to, well, put yourself in the shoes of the protagonist/singer of the song.
Assume the singer is having a conversation (which is the lyrics of the song) with, maybe a lover. Lets assume he promised her a good life, and she assumed it is going to be a bed of roses (life is not a bed of roses). He then tells her " I beg your pardon, never promised you a rose garden. Along with the sunshine, There's gotta be a little rain sometimes." something like, I am sorry (I beg your pardon), I promised you a happy life but it does not mean there will never be another sad moment in your life (never promised you a rose garden.There's gotta be a little rain sometimes.Along with the sunshine, There's gotta be a little rain sometimes.).
Imagine a conversation between our imaginary singer and the imaginary woman when something sad happened:
Woman : You promised me that you will keep me happy always
Singer : I am sorry (I beg your pardon), I promised you a happy life, true. But that does not mean that there will never be another sad moment in your life. If there is happiness there has to be a little sadness as well, you cant avoid it.
or something like that. I hope other people who answer will be able to give you the exact grammatical terms and explanation.