A court tells the prosecutor and the police not to tell the jury that the defendant has a prior arrest. Then the prosecutor asks the witness "Officer, how did you find out where the defendant lived, so that you could go there and arrest him?". The officer has of course been ordered to answer the questions and tell the truth, and so replies: "I found out from the record of a prior arrest." So there's prosecutorial misconduct. But is it misconduct on the part of the witness? Should the witness have declined to answer? And if so what would the witness say as a reason for refusing to answer?
There is a concept of prosecutorial misconduct, which relates to the prosecutor's obligation to find justice. An example of such misconduct would be suppressing evidence, as in the case of Demjanjuk v. Petrovsky 776 F.2d 571, where it was later ruled that the prosecutor committed prosecutorial misconduct, and this decision resulted in the restoration of Demnjankuk's citizenship. In the postulated scenario, the issue would be whether the prosecutor's actions prejudiced the defendant's right to a fair trial. There is a broader concept of misconduct applicable to attorneys, promulgated by the ABA, which does not per se result in cases being overturned unless it falls with the ambit of prosecutorial misconduct. None of these concepts apply to witnesses. There is also police misconduct, but that would not be applicable to disobeying a judge's orders when testifying.
A police officer or any person testifying is supposed to follow the judge's instructions, and if they do not they can be held in contempt. The judge might declare a mistrial. An alternative is to strike the testimony and instruct the jury to disregard the testimony, but as they say, you can't unring the bell. The judge has considerable latitude to punish contempt, and might well hold the witness in direct contempt, fining him or making him spend the day in the clink.
The underlying facts will bear more on who is at fault for this breach of the judge's order. For instance, if the cop had told the prosecutor that he had gotten the address from an informant, but then changed his testimony on the stand, then it really isn't prosecutorial misconduct. If the prosecutor knew what answer was forthcoming, then it may be some form of misconduct and how serious depends on a number of factors like intent and history of the prosecutor.
But the more important question is what remedy are you seeking? The most likely outcome no matter what is behind the question and answer is for the judge to instruct the jury to disregard the answer and to not use the information in weighing the evidence. If this is more prejudicial to the defendant or is part of a larger pattern of problems, then the judge may issue a special jury instruction or declare a mistrial. None of these remedies rest on who was at fault, but rather on the amount of prejudice. If, on the other hand, you want to file a bar complaint against the prosecutor, it will all come down to who said what to whom and when. If you want the judge to hold the cop in contempt (the cop can't be disbarred, unless the cop also happens to be an attorney), then the same factual inquiry would like be necessary but it would be unlikely for a judge to consider digging into the matter at all and it is entirely within her discretion as judge.
I believe the direct answer to your question is "it could be one, neither, or both, but it probably doesn't matter."
Part of the question asks "Should the witness have declined to answer"? If the witness was aware of the court's ruling on the motion to exclude, then the witness should not have answered and could have asked for a clarification from the judge (outside the presence of the jury) whether the witness can answer the question. The witness could have turned to the judge and said "Your honor, I am not sure how to answer that question within in the confines of your previous rulings." The judge would like excuse the jury and the lawyers and judges can confer.