Q:

How to convey bad news to clients? 

How to convey a bad news to the client? 

A:

When something has gone wrong the client needs to know three things:

precisely what is wrong
what the impact is on them
what you are going to do about it

If you are not completely honest and transparent you will get found out later and will compound the trouble. 
If your relationship with them is good then you probably will survive - presuming this is not completely catastrophic - but you will have to provide a decent remedy. 
If your relationship is bad, then prepare yourself for them to start playing hard-ball with you on the terms of your contract. 
HTH
Addendum:  A good comment below about telling them as soon as possible, which I am happy to surface in this answer as requested.   It reminds me of a saying "the sooner and in more detail the bad news is known, the better for everyone".   As in life, so in project management.   

A:

With an emphasis on the solutions you propose to address the bad news. 

We will not be able to have a moon
  controlling functionality in our
  system (due to ...) but we can and
  will deliver the weather changing
  module which is almost just as good
  for your world domination plans. 

Be honest and try to offer effective and realistic solutions instead of things that'll end up being more bad news. 

A:

Managing your clients/bosses expectations is a great way to avoid this.  
In an engineering discipline, the old adage remains true:

Under promise.  Over deliver. 

If you've already got the bad news, well: 

be honest and upfront about it. 
give them options about how they want you to solve it; be detailed about cost estimates. 
don't make any further promises "to make up for it".  If some of your proposed solutions offer advantages down the line, tell them; but don't say that you'll add a feature at the same time as fixing the problem.