Neil, have you ever defended someone you believed to be guilty?
The short answer is yes, but that needs some explanation. I imagine you are referring to defendants who plead not guilty. A significant proportion of defendants plead guilty and defence counsel's role is then to present a plea in mitigation, i.e. to present to the court the facts and evidence that support a more lenient sentence.
With those defendants who plead not guilty counsel's job is to challenge the prosecution evidence based upon the client's instructions, and then to present the defence case. It is not for counsel to form a view of the guilt or innocence of his client; anyone is entitled to have the case against him tested and to have his own evidence presented properly. It is then for the jury to decide whether the defendant is guilty or not guilty.
You have to remember that barristers, unlike solicitors, do not pick and choose their clients. A barrister is obliged to accept a brief if he is available and the case is within his area of expertise.