The 34-year-old has quit Aberdeen despite having a year left on his contract following talks with manager Jimmy Calderwood.
McNamara moved to the club last summer from Wolves but made only 12 SPL starts during an injury-hit campaign.
"He had a year left in his contract but he has decided not to take it up," Calderwood told the club's official website.
"It is very sad for us. He is a great professional and it has been a pleasure to work with him."
McNamara met Calderwood last week to discuss his future after being booed off the park by some Aberdeen fans when he was substituted during the Scottish Cup semi-final defeat by Queen of the South.
And, after being left out of the squad that lost 1-0 to Celtic at the weekend to consider his future, McNamara told Calderwood he wanted to leave.
Calderwood added: "I didn't want a knee-jerk reaction following the disappointments of the Queen of the South game and gave him time to discuss matters with his family.
"However, between travelling and injuries, it's been a frustrating spell for him and he's decided to leave. He'll certainly be a big loss."