As simply as it can be put The Pharisees, were to the Church what Academia is to the world today, in that they were the supposed experts in the law, and were trusted with teaching the law to the public.
Jesus was scolding them because they had missed the true meaning of what the law, was intended to mean.
To that end both Mason Wheeler, and confutus are correct that he was referring to the passage in Hosea. Rick's answer that he was referring to the inappropriate administering of God's law is also correct, but needs some more explanation.
Like we Christians today the Israelites were determined to do their best to please God, and the Jews of today still try to obey some very strenuous laws to do so.
Jesus scolding of the Pharisees could easily be applied to some today, in that what Jesus was telling both them and us today is that no Sacrifice will atone for sin without God's grace.
Even to this day far too many people still do not understand how forgiveness works through sacrifice.
one joke that was told to me pretty well sums up the discrepancy;
Baptist do not recognize other Baptist in the liquor store. That is meant to be funny, and we can laugh at it,(which I did), but on closer inspection there is far too much truth there.
The real message Jesus meant to convey, was that the Pharisees were deluding the people by teaching them that forgiveness was earned by doing all those things and then making a sacrifice to God.
The true meaning of Jesus was (knowing that He was the ultimate sacrifice) Do you think that I came down from Heaven, to suffer and die for such menial things?
My Jesus did not suffer and die, for any other reason than to bring God' Mercy, to those who truly regret that they have saddened God, by their selfishness.
consider these Scriptures:
Matthew 26:28 KJV For this is my blood of the new testament, which is shed for many for the remission of sins.
I have highlighted the second part because it says for many and not all.
Matthew 7:14 KJV Because strait is the gate, and narrow is the way, which leadeth unto life, and few there be that find it.
finally consider these Scriptures:
Matthew 7:21 through 23 KJV
Not every one that saith unto me, Lord, Lord, shall enter into the kingdom of heaven; but he that doeth the will of my Father which is in heaven. Many will say to me in that day, Lord, Lord, have we not prophesied in thy name? and in thy name have cast out devils? and in thy name done many wonderful works? And then will I profess unto them, I never knew you: depart from me, ye that work iniquity.
Back to your original question The true emphasis in:
"But if ye had known what this meaneth, I desire mercy, and not sacrifice, ye would not have condemned the guiltless."
is "If you had taught the true meaning of the Scriptures, you would know that these are innocent in God's eyes, but guilty in yours, because you have perverted God's laws."