The line of sight (LoS) probability is a key factor for the channel modeling of air-to-ground (A2G) communication. However, the existing LoS probability models do not account for the effects of airframe shadowing (AS) and building density, which can cause serious link obstruction and performance loss due to the six-dimensional (6D) mobility and self-body of unmanned aerial vehicle (UAV). In this paper, a new LoS probability model is proposed that considers the AS and building density for different UAV heights. Adding to this, the AS is derived in terms of UAV framework and 6D mobility. Next, the machine learning (ML) based graph neural network (GNN) method is developed to learn the features and structure of the urban environment and predict the LoS probability. Then, the GNN model is trained and evaluated based on the ray tracing (RT) data to establish the relationship between model parameters and UAV heights under the building density and AS factors. The interpretation and explanation of the proposed GNN model and prediction are also discussed in this paper. It is shown from the simulation analysis that the GNN model accurately captures the effects of AS, building height distributions, and UAV heights, with high accuracy compared to the baseline 3GPP, GCM and NYU models.