With the emergence of autonomous driving, the demands on reliability of positioning using Global Navigation Satellite System (GNSS) are higher than ever. However, due to multipath and Non-Line-of-Sight (NLOS) reception, dense urban areas remain a highly challenging environment for accurate and robust GNSS-based localization. In this paper, we propose a novel approach to address the detection of NLOS signals and for the subsequent rectification of the introduced errors. Several state of the art algorithms either use a priori knowledge of the surroundings, e.g. previously known 3D maps or exclude NLOS affected satellite signals. In contrast, our proposed method utilizes a low-cost LiDAR sensor for perception and online mapping of the environment and allows the consideration of NLOS signals, i.e., such signal still make a contribution to the position solution. Ultimately, NLOS satellites are detected by a ray tracing technique based on surface reconstruction of building facades and ephemeris information. An NLOS error model considering reflected signals is applied in order to correct errors caused by NLOS reception. Our proposed algorithm consists of three main steps, namely a novel multi-plane detection algorithm for urban canyons, the detection of NLOS satellites and the rectification of the NLOS error based on the detected surfaces. Experimental validation of the proposed approach is conducted with a hardware configuration consisting of a ublox GNSS receiver, a Livox Horizon LiDAR and an industrial grade inertial measurement unit (IMU) mounted on a test vehicle in an area narrowly confined by buildings from three sides. The results proof the effectiveness of our algorithm in significantly improving GNSS positioning accuracy in dense urban canyons. While in our chosen scenario the maximum error of the corrected positions compared to the ground truth improved only slightly from 12.443 m to 11.487 m, the mean error was greatly reduced from 10.574 m to 2.655 m, without any further sensor fusion.