Yes, you have a problem. I need to tell you this...For your sake, your children's sake, and the sake of your marriage, stop your affair NOW...THIS MINUTE!! Please don't continue with this. Simply tell your girlfriend you need to sort some things out and move along. You have invested 12 years into a marriage and produced 2 kids, that I am sure you don't want to mess with. THIS IS THE FIRST AND MOST IMPORTANT STEP...
NEXT...You and your wife obviously need some counseling. There is a reason why she doesn't want sex. Has she gained weight? Have you gained weight? Are either or you ill? Is SHE having an affair? Do you treat her the way you want her to treat you? Liven up the relationship. Surprise her with kind words, affection, and genuine friendship. You don't need to rush down to the local florist or jeweler..that doesn't buy love. Write her a note. Tell her your feelings. Express yourself! You may not realize this, but it IS possible that you are NOT open with her, which makes her resent you or keep her distance from you. Believe me when I tell you all of this. NOW...it is quite possible your wife is unloving and unaffectionate. I have a sister in law who is so mean no matter what my brother does for her. These type cannot be changed so easily, and sometimes it's not worth it if they are not willing. TWO people have to be willing to work things out; one can't do it on their own! Have a serious talk with her. Does she want to stay in this marriage? Is she is love with you? ASK HER STRAIGHT UP QUESTIONS and figure out where the two of you are in this marriage. Not everyone is compatible, but it is possible you two DO love each other under all of this.
Once again, the girlfriend has to go no matter what feelings you have right now. You have too much to take care of BEFORE you can have a girlfriend who is "in love" with you. That is too heavy for you right now. If things really can't be fixed at home, this girl will be there if it's true love. (Remember, it MAY not be true love for YOU, but a shoulder to cry on instead. I wouldn't jump into anything myself). I understand you are not happy at home, and I don't blame you.
COMMUNICATION IS THE KEY TO EVERY RELATIONSHIP...I wish you well, and I want you to remember that everything works out in the end with effort.