This paper proposes a method for trajectory planning for an Unmanned Aerial Vehicle (UAV) in three dimensions using Partial Differential Equations (PDEs) for application in dynamic hostile environments. The proposed method exploits the dynamical property of fluid flowing through a porous medium. This method evaluates risk to generate porosity values through out the computational domain. The path that encounters the highest porosity values determines the path from the point of origin to the goal position. The best trajectory is found using the reaction of the fluid in porous media obtained by the analytical solution of the PDEs representing the fluid flow. Constraints due to UAV dynamics, obstacles, and predefined way points are applied to the problem after solving for the best trajectory to find the optimal path. This method shows near-optimality and much reduced computational effort when compared to other typical analytical optimization methods.