The company offering this service is called 118800 and numbers in their database are collected from market research companies, from online businesses and from brokers who buy and sell lists of phone numbers.
There's more on this on the BBC's Working Lunch pages here: http://news.bbc.co.uk/1/hi/programmes/working_lunch/8091621.stm
To unsubscribe, go here: http://www.118800.co.uk/removeme/remove.html (make sure you have the relevant phone with you when you do this because 118800 sends you a code by text, which you have to then enter onto the website). More simply, text the letter 'E' to 118800 from the mobile phone you want to be made ex-directory. 118800 will send you an SMS message confirming you've been taken off.
I'm told you need to do this before next week to ensure you're excluded from the directory, but checking the website just now they say allow up to 4 weeks to be excluded.