Shortest root using machine learning/AI
Like others already stated: this is not a typical "Artificial Intelligence" problem. It is kind of a path planning problem.
There are different algorithms available. If your path doesn't neet to satisfy any constraints like .g. smoothness, you can use an A*-Algorithm with distance as heuristic.
You have to represent your XYZ-space as a Graph where each node has a coordinate. Further you need to take into account, that no nodes lie near the points you want to avoid.  
If your path needs to satisfy constraints, this turns into a more complicated path planning problem where you could apply optimization or RRTs.
Assume that I have set of points scattered on the XY plane, and i have two points say start and end point any where in XY plane. I want to find the shortest path between start and end point without touching scattered points. The path has to maintain certain offset ( i.e assume path has some width ). 
How to approach this kind of problems in programming, Are there any algorithms in machine learning.