I did something similar, and I fully agree with @Ghost and @Davidmh's advice which upholds honesty is the only policy in academia. I shall tell you what I did (NOTE: I am sharing my personal experience, by no means I am asserting that my way is the way that it should be handled, as situations differ).
In my second year of PhD, I realized that I was not satisfied with my research area, and that I should look for an opportunity which will let me explore ideas that I want to for my PhD.
After I made contact with a professor with whom I would have liked to work, I informed the person that I am yet to have a discussion with my present adviser regarding moving to another university, and requested him/her to refrain from contacting my present adviser, until I could have that discussion. After getting an approval from the school and the potential adviser, that I would most possibly be offered a position, I sought out to have a discussion with my current adviser to make him/her aware of the situation.
In that discussion, I was very frank about why I am considering to leave my lab, and that I would be very open for future collaborations. I spent the rest of the semester wrapping up my work and discussing about future project directions with my mentor and another lab-member who took up my role. I left the lab on a nice note, and I still maintain a healthy relationship with my previous adviser and lab members.
In research, we never know with whom we would need to collaborate in the future. Apart from that, many jobs require recommendations from past advisers. Hence, having a trust-issue-free-relationship with peers, advisers and fellow researchers is a must for personal development.